RefLib

Reference library for AI

Back

postgresql_16:9.6.4 auto_explain — log execution plans of slow queries

PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > auto_explain — log execution plans of slow queries

The auto_explain module provides a means for logging execution plans of slow statements automatically, without having to run (see postgresql_16:7.1.146) by hand. This is especially helpful for tracking down un-optimized queries in large applications.

The module provides no SQL-accessible functions. To use it, simply load it into the server. You can load it into an individual session: LOAD 'auto_explain'; (You must be superuser to do that.) More typical usage is to preload it into some or all sessions by including auto_explain in (see guc-session-preload-libraries) or (see guc-shared-preload-libraries) in postgresql.conf. Then you can track unexpectedly slow queries no matter when they happen. Of course there is a price in overhead for that.

Subsections

Back