Slow Query Log
Cheat sheet · https://pcornel.dk/topic.php?topic=6190
Answer
The slow query log records queries slower than a threshold (MySQL slow_query_log/long_query_time; PostgreSQL log_min_duration_statement; SQL Server via Query Store/Extended Events).
Remember
Aggregate the log (pt-query-digest, pgBadger) rather than reading raw lines; optimise by total time. Avoid too-low thresholds on busy servers.
First checks
pt-query-digest slow.log— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
query exceeds threshold → logged → aggregated → optimised
Where it usually breaks
A threshold of 0 on a busy server floods the log.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6190