Skip to main content

What is a slow query log and when should you enable it?

Junior MySQL
Quick Answer Slow query log records queries that exceed long_query_time seconds. Enable: slow_query_log=ON, slow_query_log_file=/path/to/log, long_query_time=1.0. Also log queries without indexes: log_queries_not_using_indexes=ON. Use mysqldumpslow or pt-query-digest to analyze the log and find top offenders. Enable in production to catch performance regressions early.

Answer

The slow query log records queries that exceed a specified execution time. It helps identify unoptimized queries or missing indexes.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice