GNU Info

Info Node: (mysql.info)Query Speed

(mysql.info)Query Speed


Next: Locking Issues Prev: Optimize Overview Up: MySQL Optimization
Enter node , (file) or (file)node

Optimizing `SELECT's and Other Queries
======================================

First, one thing that affects all queries: The more complex permission
system setup you have, the more overhead you get.

If you do not have any `GRANT' statements done, MySQL will optimize the
permission checking somewhat. So if you have a very high volume it may
be worth the time to avoid grants. Otherwise more permission check
results in a larger overhead.

If your problem is with some explicit MySQL function, you can always
time this in the MySQL client:

     mysql> select benchmark(1000000,1+1);
     +------------------------+
     | benchmark(1000000,1+1) |
     +------------------------+
     |                      0 |
     +------------------------+
     1 row in set (0.32 sec)

The above shows that MySQL can execute 1,000,000 `+' expressions in
0.32 seconds on a `PentiumII 400MHz'.

All MySQL functions should be very optimized, but there may be some
exceptions, and the `benchmark(loop_count,expression)' is a great tool
to find out if this is a problem with your query.

EXPLAIN
`EXPLAIN' Syntax (Get Information About a `SELECT')
Estimating performance
Estimating query performance
SELECT speed
Speed of `SELECT' queries
Where optimizations
How MySQL optimizes `WHERE' clauses
DISTINCT optimization
How MySQL Optimizes `DISTINCT'
LEFT JOIN optimization
How MySQL optimizes `LEFT JOIN'
LIMIT optimization
How MySQL optimizes `LIMIT'
Insert speed
Speed of `INSERT' queries
Update speed
Speed of `UPDATE' queries
Delete speed
Speed of `DELETE' queries
Tips
Other Optimization Tips

automatically generated by info2www version 1.2.2.9