M
M
modesden2016-09-11 15:40:29
PHP
modesden, 2016-09-11 15:40:29

What can be used to track heavy queries in the mysql database?

Good afternoon!
What (preferably free) tool can track heavy queries in the mysql database. The site takes a long time to load when loading the ad list page. It is necessary to find out on what request time is spent. The site is written in php(yii).
I will be very grateful.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
C
CyberHost, 2016-09-11
@modesden

toolbar

A
Anton Yankovsky, 2016-09-12
@webpavilion

In my.cnf you need to add:

[mysqld]
...
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 10
log_queries_not_using_indexes = YES
log_slow_admin_statements = YES

  • long_query_time - casting time in seconds
  • log_queries_not_using_indexes - queries on columns without indexes
  • log_slow_filter - additional filter by types of slow requests (not always and not available everywhere)
  • log_slow_admin_statements - log administrative requests
mysqldumpslow is a utility for convenient viewing of logs, it runs locally in the same place where mysql is installed (parameters in the request are replaced with the 'S' character, if you run it with the -a key, everything will be like in the original request)

U
un1t, 2016-09-11
@un1t

slow log
show processlist;

A
Andrey Uteshev, 2016-09-15
@veshetu

to the heap:
mysqltop
utility for linux like top|atop}apachetop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question