Skip to content

Instantly share code, notes, and snippets.

@andyatkinson
Last active October 4, 2023 22:52
Show Gist options
  • Save andyatkinson/59b124e3706d805dc5a6055e3ac86985 to your computer and use it in GitHub Desktop.
Save andyatkinson/59b124e3706d805dc5a6055e3ac86985 to your computer and use it in GitHub Desktop.
Enabling automatic query execution plans via auto_explain
# Prereq: auto_explain added to shared_preload_libraries
# Compute the Query Identifier
compute_query_id = on
# Logging duration
log_duration = on
# Logging Query Identifier (%Q)
log_line_prefix = 'pid=%p query_id=%Q: '
# slow query logging, all queries for demo (don't do this in prod)
log_min_duration_statement = 0
# auto_explain (ms), > 10ms for demo
auto_explain.log_min_duration = 10
# Equivalent to VERBOSE when using EXPLAIN
# https://www.postgresql.org/docs/current/auto-explain.html
auto_explain.log_verbose = on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment