I am about to analyze slow queries, but I’m still new to Percona, can anyone give me a clue on how to enable the general and slow query logging?
Hi @budiantoip
To check whether general and slow logs enabled, please use below command:
MySQL>show global variables like “general_log%”;
MySQL>show global variables like “slow_que%”;
Also once you enable the slow_query_log you also have to check what is long_query_time:
show global variables like “long_query%”;
Long_query_time: The value represents in seconds, for e.g. if the value is 10, this means any query which takes 10 or more than 10 seconds it will be considered as slow query and further will be logged in to the slow_query_log_file (if slow_query_log is ON/enabled).
Hope this helps.
Hi @vaibhav_upadhyay40, thank you for your reply, I finally changed the server configuration, by adding these variables to the configuration file :
slow_query_log = 1slow_query_log_file = /var/log/mysql/slow.loglong_query_time = 1
I was finally able to read the slow queries.
Happy to know
To write general and slow query log entries only to the log tables, use --log_output=TABLE to select tables as the log destination and --general_log and --slow_query_log to enable both logs. For more visit here.