fbpx

MySql Query Optimization

MySql Query Optimization

You can turn on the slow query logs in configrations and then see logs by mysqldumpslow command

mysqldumpslow -s c -t 30 /var/log/mysql/mysql-slow.log

 
You can optimize your queries with explain command

explain extended
<Execute your query here>

 
MySQL Explain has different row count than slow query log. Try the below command to get more stats.

FLUSH STATUS;
<Execute your query here>
SHOW STATUS like 'Hand%';

 
 

Share this post