PostgreSQL Performance with auto_explain

📌 Installation & Configuration:


1: Install the extension:

CREATE EXTENSION auto_explain;

2: Load it into the server:

LOAD 'auto_explain';

3: Set up the configuration parameters in postgresql.conf:

# postgresql.conf

session_preload_libraries = 'auto_explain'

auto_explain.log_min_duration = '3s'


🔧 Configuration Parameters:

  • auto_explain.log_min_duration: Minimum execution time to log a plan.
  • auto_explain.log_parameter_max_length: Control logging of query parameter values.
  • auto_explain.log_analyze: Print EXPLAIN ANALYZE output.
  • auto_explain.log_buffers: Print buffer usage statistics.
  • auto_explain.log_wal: Print WAL usage statistics.
  • auto_explain.log_timing: Control per-node timing information.
  • auto_explain.log_triggers: Include trigger execution statistics.
  • auto_explain.log_verbose: Control verbose details.
  • auto_explain.log_settings: Print information about modified configuration options.
  • auto_explain.log_format: Select EXPLAIN output format (text, xml, json, yaml).
  • auto_explain.log_level: Select log level (DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, LOG).
  • auto_explain.log_nested_statements: Log nested statements.
  • auto_explain.sample_rate: Explain a fraction of the statements in each session.

To view or add a comment, sign in

Explore content categories