Jump to Navigation

043 - To optimize a slow MySQL query

  1. Find out whether the application is retrieving more data than you need. That usually means it’s accessing too many rows, but it might also be accessing too many columns.
  2. Find out whether the MySQL server is analyzing more rows than it needs.
    (Use EXPLAIN’s output to understand.)
  3. Chopping up a query. Running it in smaller chunks that affect fewer rows each time.
  4. Optimize a table, OPTIMAIZE TABLE statement to optimize the data contained in a table. This statement also repairs some row problems and sort indexes. It means the query performance might be improved.

Main menu 2

Story | by Dr. Radut