(I) any query is annoying.
As long as the query and MySQL are annoying, the fastest way to execute the query is not to execute
Cache is king, such as Redis or memcache
(Ii) Minimum query result set
Try to query based on the primary key or secondary index, and avoid returning the table by overwriting the index to save IO
For example:
Select col1 from table where primary_key_column = something;
(3) query with JOINS
Use appropriate anti-paradigm to avoid JOIN
For example:
SELECT t2.value FROM t2 JOIN t1 ON (t1.id = t2.tid) WHERE t1.orderdate = NOW ()
You can extract the orderdate column in t1 and place it in t2.
SELECT t2.value FROM t2 WHERE t2.orderdate = NOW ()
(Iv) Aggregate Query is the most annoying
Periodic pre-load summary tables to avoid real-time online Aggregate Queries
Using INSERT... on duplicate key update is helpful.
MySQL queries the first n records
MySQL query optimization: LIMIT 1 avoids full table Scan
MySQL query optimization: Use subqueries instead of non-primary key connection queries
MySQL Query Optimization-Show command
MySQL query does not use index summary