Log slow query plans automatically in the server logs.

Section: EXPLAIN and Plan Analysis

Enable auto_explain

sql
sql
LOAD 'auto_explain';
SET auto_explain.log_min_duration = '200ms';
SET auto_explain.log_analyze = on;
Explanation

See summary for usage details.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing EXPLAIN and Plan Analysis
EXPLAIN query
Show the planner's chosen execution plan.
OpenIn sheetsqlsame section
EXPLAIN ANALYZE
Run the query and show actual timing and buffer usage.
OpenIn sheetsqlsame section
EXPLAIN VERBOSE
Include more detail about output columns and active settings.
OpenIn sheetsqlsame section
EXPLAIN JSON format
Return the plan as machine-readable JSON.
OpenIn sheetsqlsame section
Keyset pagination
Prefer keyset pagination over deep OFFSET scans for large result sets.
OpenIn sheetsql1 tag match
Select needed columns
Avoid fetching unnecessary columns, especially wide rows.
OpenIn sheetsql1 tag match