v.20.11New Feature

Add log_queries_min_query_duration_ms Setting for Query Logging

Add log_queries_min_query_duration_ms, only queries slower than the value of this setting will go to query_log/query_thread_log (i.e. something like slow_query_log in mysql). #16529 (Azat Khuzhin).
Introduced the log_queries_min_query_duration_ms setting, which filters queries logged to query_log and query_thread_log based on their execution duration, enabling logging only for queries slower than the specified threshold.

Why it matters

This feature helps users monitor and analyze slow queries by reducing noise in query logs. By logging only queries exceeding a specified duration, it improves efficiency in identifying performance bottlenecks similar to MySQL's slow query log.

How to use it

Set the log_queries_min_query_duration_ms parameter to a duration in milliseconds. Queries with execution time longer than this value will be logged to query_log and query_thread_log. For example:

SET log_queries_min_query_duration_ms = 1000;

This configuration logs only queries running longer than 1000 milliseconds.