Daily Archives: July 26, 2009

MySQL Slow Query Optimization Tips

Slow Query Example SELECT widget_id , widget_name , COUNT(DISTINCT type) AS num_types FROM widget GROUP BY type ORDER BY num_types DESC With lots (>100K) of rows, this query will get slow because it orders on an aggregate COUNT DISTINCT function. … Continue reading

Leave a comment