v.21.9Improvement
Add log_formatted_queries Setting for Enhanced Query Analysis
Add settinglog_formatted_queriesto log additional formatted query intosystem.query_log. It's useful for normalized query analysis because functions likenormalizeQueryandnormalizeQueryKeepNamesdon't parse/format queries in order to achieve better performance. #27380 (Amos Bird).
Why it matters
This feature provides a normalized and formatted representation of queries insystem.query_log, improving the ability to analyze and understand query patterns. Unlike existing normalization functions such as normalizeQuery and normalizeQueryKeepNames, which avoid parsing and formatting for performance reasons, this setting enables capturing fully formatted queries for more detailed analysis.How to use it
Enable the feature by settinglog_formatted_queries to 1 (true) in your server configuration or session settings. Once enabled, additional formatted queries will be logged in the system.query_log table alongside the original query entries.