How to register mySQL queries without indexes?

I see there is a good option how to enable slow log queries and queries without indexes:

SET GLOBAL log_queries_not_using_indexes=1; SET GLOBAL log_slow_queries=1; 

OK, OK, but it seems that they are being written to the same log file that I specified in the my.cnf configuration file:

  [mysqld] long_query_time = 1 log-slow-queries = /var/log/mysql/mysql-slow.log 

I use mysqldumpslow to view the slowest queries, but what do I need to do to see queries without indexes separately?

Could you help me?

Thank you in advance!

Best

Jakub

+6
source share
1 answer

You can not. The log file is a text file, and you cannot conclude whether the query used the index at run time. In addition, the log-queries-not-using-indexes option does not necessarily log queries that do not use an index, see :

If you use this option when the slow query log is turned on, queries that are expected to retrieve all rows are logged. See Section 5.2.5, “Slow Query Log”. This parameter does not necessarily mean that there is no index. For example, a query that uses a full index scan uses an index, but will be registered because the index will not limit the number of rows.

+7
source

Source: https://habr.com/ru/post/895252/


All Articles