PostgreSQL Source Code  git master
auto_explain.c File Reference
#include "postgres.h"
#include <limits.h>
#include "access/parallel.h"
#include "commands/explain.h"
#include "executor/instrument.h"
#include "jit/jit.h"
#include "utils/guc.h"
Include dependency graph for auto_explain.c:

Go to the source code of this file.

Macros

#define auto_explain_enabled()
 

Functions

void _PG_init (void)
 
void _PG_fini (void)
 
static void explain_ExecutorStart (QueryDesc *queryDesc, int eflags)
 
static void explain_ExecutorRun (QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
 
static void explain_ExecutorFinish (QueryDesc *queryDesc)
 
static void explain_ExecutorEnd (QueryDesc *queryDesc)
 

Variables

 PG_MODULE_MAGIC
 
static int auto_explain_log_min_duration = -1
 
static bool auto_explain_log_analyze = false
 
static bool auto_explain_log_verbose = false
 
static bool auto_explain_log_buffers = false
 
static bool auto_explain_log_triggers = false
 
static bool auto_explain_log_timing = true
 
static bool auto_explain_log_settings = false
 
static int auto_explain_log_format = EXPLAIN_FORMAT_TEXT
 
static int auto_explain_log_level = LOG
 
static bool auto_explain_log_nested_statements = false
 
static double auto_explain_sample_rate = 1
 
static const struct config_enum_entry format_options []
 
static const struct config_enum_entry loglevel_options []
 
static int nesting_level = 0
 
static bool current_query_sampled = false
 
static ExecutorStart_hook_type prev_ExecutorStart = NULL
 
static ExecutorRun_hook_type prev_ExecutorRun = NULL
 
static ExecutorFinish_hook_type prev_ExecutorFinish = NULL
 
static ExecutorEnd_hook_type prev_ExecutorEnd = NULL
 

Macro Definition Documentation

◆ auto_explain_enabled

#define auto_explain_enabled ( )
Value:
static bool current_query_sampled
Definition: auto_explain.c:64
static bool auto_explain_log_nested_statements
Definition: auto_explain.c:35
static int nesting_level
Definition: auto_explain.c:61
static int auto_explain_log_min_duration
Definition: auto_explain.c:26

Definition at line 66 of file auto_explain.c.

Referenced by explain_ExecutorEnd(), and explain_ExecutorStart().

Function Documentation

◆ _PG_fini()

void _PG_fini ( void  )

Definition at line 238 of file auto_explain.c.

References ExecutorEnd_hook, ExecutorFinish_hook, ExecutorRun_hook, ExecutorStart_hook, prev_ExecutorEnd, prev_ExecutorFinish, prev_ExecutorRun, and prev_ExecutorStart.

239 {
240  /* Uninstall hooks. */
245 }
static ExecutorRun_hook_type prev_ExecutorRun
Definition: auto_explain.c:73
ExecutorStart_hook_type ExecutorStart_hook
Definition: execMain.c:70
static ExecutorStart_hook_type prev_ExecutorStart
Definition: auto_explain.c:72
ExecutorRun_hook_type ExecutorRun_hook
Definition: execMain.c:71
ExecutorEnd_hook_type ExecutorEnd_hook
Definition: execMain.c:73
static ExecutorFinish_hook_type prev_ExecutorFinish
Definition: auto_explain.c:74
static ExecutorEnd_hook_type prev_ExecutorEnd
Definition: auto_explain.c:75
ExecutorFinish_hook_type ExecutorFinish_hook
Definition: execMain.c:72

◆ _PG_init()

void _PG_init ( void  )

Definition at line 92 of file auto_explain.c.

References auto_explain_log_analyze, auto_explain_log_buffers, auto_explain_log_format, auto_explain_log_level, auto_explain_log_min_duration, auto_explain_log_nested_statements, auto_explain_log_settings, auto_explain_log_timing, auto_explain_log_triggers, auto_explain_log_verbose, auto_explain_sample_rate, DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), EmitWarningsOnPlaceholders(), ExecutorEnd_hook, ExecutorFinish_hook, ExecutorRun_hook, ExecutorStart_hook, explain_ExecutorEnd(), explain_ExecutorFinish(), explain_ExecutorRun(), explain_ExecutorStart(), EXPLAIN_FORMAT_TEXT, GUC_UNIT_MS, LOG, PGC_SUSET, prev_ExecutorEnd, prev_ExecutorFinish, prev_ExecutorRun, and prev_ExecutorStart.

93 {
94  /* Define custom GUC variables. */
95  DefineCustomIntVariable("auto_explain.log_min_duration",
96  "Sets the minimum execution time above which plans will be logged.",
97  "Zero prints all plans. -1 turns this feature off.",
99  -1,
100  -1, INT_MAX,
101  PGC_SUSET,
102  GUC_UNIT_MS,
103  NULL,
104  NULL,
105  NULL);
106 
107  DefineCustomBoolVariable("auto_explain.log_analyze",
108  "Use EXPLAIN ANALYZE for plan logging.",
109  NULL,
111  false,
112  PGC_SUSET,
113  0,
114  NULL,
115  NULL,
116  NULL);
117 
118  DefineCustomBoolVariable("auto_explain.log_settings",
119  "Log modified configuration parameters affecting query planning.",
120  NULL,
122  false,
123  PGC_SUSET,
124  0,
125  NULL,
126  NULL,
127  NULL);
128 
129  DefineCustomBoolVariable("auto_explain.log_verbose",
130  "Use EXPLAIN VERBOSE for plan logging.",
131  NULL,
133  false,
134  PGC_SUSET,
135  0,
136  NULL,
137  NULL,
138  NULL);
139 
140  DefineCustomBoolVariable("auto_explain.log_buffers",
141  "Log buffers usage.",
142  NULL,
144  false,
145  PGC_SUSET,
146  0,
147  NULL,
148  NULL,
149  NULL);
150 
151  DefineCustomBoolVariable("auto_explain.log_triggers",
152  "Include trigger statistics in plans.",
153  "This has no effect unless log_analyze is also set.",
155  false,
156  PGC_SUSET,
157  0,
158  NULL,
159  NULL,
160  NULL);
161 
162  DefineCustomEnumVariable("auto_explain.log_format",
163  "EXPLAIN format to be used for plan logging.",
164  NULL,
168  PGC_SUSET,
169  0,
170  NULL,
171  NULL,
172  NULL);
173 
174  DefineCustomEnumVariable("auto_explain.log_level",
175  "Log level for the plan.",
176  NULL,
178  LOG,
180  PGC_SUSET,
181  0,
182  NULL,
183  NULL,
184  NULL);
185 
186  DefineCustomBoolVariable("auto_explain.log_nested_statements",
187  "Log nested statements.",
188  NULL,
190  false,
191  PGC_SUSET,
192  0,
193  NULL,
194  NULL,
195  NULL);
196 
197  DefineCustomBoolVariable("auto_explain.log_timing",
198  "Collect timing data, not just row counts.",
199  NULL,
201  true,
202  PGC_SUSET,
203  0,
204  NULL,
205  NULL,
206  NULL);
207 
208  DefineCustomRealVariable("auto_explain.sample_rate",
209  "Fraction of queries to process.",
210  NULL,
212  1.0,
213  0.0,
214  1.0,
215  PGC_SUSET,
216  0,
217  NULL,
218  NULL,
219  NULL);
220 
221  EmitWarningsOnPlaceholders("auto_explain");
222 
223  /* Install hooks. */
232 }
static double auto_explain_sample_rate
Definition: auto_explain.c:36
void DefineCustomIntVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, int minValue, int maxValue, GucContext context, int flags, GucIntCheckHook check_hook, GucIntAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:8599
static int auto_explain_log_level
Definition: auto_explain.c:34
static ExecutorRun_hook_type prev_ExecutorRun
Definition: auto_explain.c:73
static bool auto_explain_log_verbose
Definition: auto_explain.c:28
static bool auto_explain_log_buffers
Definition: auto_explain.c:29
static bool auto_explain_log_nested_statements
Definition: auto_explain.c:35
static void explain_ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: auto_explain.c:251
static int auto_explain_log_format
Definition: auto_explain.c:33
#define LOG
Definition: elog.h:26
void DefineCustomRealVariable(const char *name, const char *short_desc, const char *long_desc, double *valueAddr, double bootValue, double minValue, double maxValue, GucContext context, int flags, GucRealCheckHook check_hook, GucRealAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:8629
void DefineCustomEnumVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, const struct config_enum_entry *options, GucContext context, int flags, GucEnumCheckHook check_hook, GucEnumAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:8684
ExecutorStart_hook_type ExecutorStart_hook
Definition: execMain.c:70
static ExecutorStart_hook_type prev_ExecutorStart
Definition: auto_explain.c:72
static void explain_ExecutorFinish(QueryDesc *queryDesc)
Definition: auto_explain.c:337
static const struct config_enum_entry format_options[]
Definition: auto_explain.c:38
ExecutorRun_hook_type ExecutorRun_hook
Definition: execMain.c:71
ExecutorEnd_hook_type ExecutorEnd_hook
Definition: execMain.c:73
Definition: guc.h:75
void EmitWarningsOnPlaceholders(const char *className)
Definition: guc.c:8712
static int auto_explain_log_min_duration
Definition: auto_explain.c:26
static bool auto_explain_log_timing
Definition: auto_explain.c:31
static ExecutorFinish_hook_type prev_ExecutorFinish
Definition: auto_explain.c:74
static const struct config_enum_entry loglevel_options[]
Definition: auto_explain.c:46
static bool auto_explain_log_analyze
Definition: auto_explain.c:27
static void explain_ExecutorEnd(QueryDesc *queryDesc)
Definition: auto_explain.c:360
static ExecutorEnd_hook_type prev_ExecutorEnd
Definition: auto_explain.c:75
static void explain_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: auto_explain.c:313
ExecutorFinish_hook_type ExecutorFinish_hook
Definition: execMain.c:72
static bool auto_explain_log_settings
Definition: auto_explain.c:32
void DefineCustomBoolVariable(const char *name, const char *short_desc, const char *long_desc, bool *valueAddr, bool bootValue, GucContext context, int flags, GucBoolCheckHook check_hook, GucBoolAssignHook assign_hook, GucShowHook show_hook)
Definition: guc.c:8573
#define GUC_UNIT_MS
Definition: guc.h:225
static bool auto_explain_log_triggers
Definition: auto_explain.c:30

◆ explain_ExecutorEnd()

static void explain_ExecutorEnd ( QueryDesc queryDesc)
static

Definition at line 360 of file auto_explain.c.

References ExplainState::analyze, auto_explain_enabled, auto_explain_log_analyze, auto_explain_log_buffers, auto_explain_log_format, auto_explain_log_level, auto_explain_log_min_duration, auto_explain_log_settings, auto_explain_log_timing, auto_explain_log_triggers, auto_explain_log_verbose, ExplainState::buffers, ExplainState::costs, StringInfoData::data, ereport, errhidestmt(), errmsg(), EXPLAIN_FORMAT_JSON, ExplainBeginOutput(), ExplainEndOutput(), ExplainPrintJITSummary(), ExplainPrintPlan(), ExplainPrintTriggers(), ExplainQueryText(), ExplainState::format, InstrEndLoop(), QueryDesc::instrument_options, StringInfoData::len, NewExplainState(), pfree(), prev_ExecutorEnd, ExplainState::settings, standard_ExecutorEnd(), ExplainState::str, ExplainState::summary, ExplainState::timing, Instrumentation::total, QueryDesc::totaltime, and ExplainState::verbose.

Referenced by _PG_init().

361 {
362  if (queryDesc->totaltime && auto_explain_enabled())
363  {
364  double msec;
365 
366  /*
367  * Make sure stats accumulation is done. (Note: it's okay if several
368  * levels of hook all do this.)
369  */
370  InstrEndLoop(queryDesc->totaltime);
371 
372  /* Log plan if duration is exceeded. */
373  msec = queryDesc->totaltime->total * 1000.0;
374  if (msec >= auto_explain_log_min_duration)
375  {
377 
381  es->timing = (es->analyze && auto_explain_log_timing);
382  es->summary = es->analyze;
385 
386  ExplainBeginOutput(es);
387  ExplainQueryText(es, queryDesc);
388  ExplainPrintPlan(es, queryDesc);
390  ExplainPrintTriggers(es, queryDesc);
391  if (es->costs)
392  ExplainPrintJITSummary(es, queryDesc);
393  ExplainEndOutput(es);
394 
395  /* Remove last line break */
396  if (es->str->len > 0 && es->str->data[es->str->len - 1] == '\n')
397  es->str->data[--es->str->len] = '\0';
398 
399  /* Fix JSON to output an object */
401  {
402  es->str->data[0] = '{';
403  es->str->data[es->str->len - 1] = '}';
404  }
405 
406  /*
407  * Note: we rely on the existing logging of context or
408  * debug_query_string to identify just which statement is being
409  * reported. This isn't ideal but trying to do it here would
410  * often result in duplication.
411  */
413  (errmsg("duration: %.3f ms plan:\n%s",
414  msec, es->str->data),
415  errhidestmt(true)));
416 
417  pfree(es->str->data);
418  }
419  }
420 
421  if (prev_ExecutorEnd)
422  prev_ExecutorEnd(queryDesc);
423  else
424  standard_ExecutorEnd(queryDesc);
425 }
bool summary
Definition: explain.h:37
static int auto_explain_log_level
Definition: auto_explain.c:34
ExplainState * NewExplainState(void)
Definition: explain.c:285
static bool auto_explain_log_verbose
Definition: auto_explain.c:28
static bool auto_explain_log_buffers
Definition: auto_explain.c:29
void standard_ExecutorEnd(QueryDesc *queryDesc)
Definition: execMain.c:471
int errhidestmt(bool hide_stmt)
Definition: elog.c:1055
static int auto_explain_log_format
Definition: auto_explain.c:33
bool costs
Definition: explain.h:34
bool analyze
Definition: explain.h:33
int instrument_options
Definition: execdesc.h:44
void InstrEndLoop(Instrumentation *instr)
Definition: instrument.c:110
void ExplainEndOutput(ExplainState *es)
Definition: explain.c:3803
#define auto_explain_enabled()
Definition: auto_explain.c:66
void ExplainPrintTriggers(ExplainState *es, QueryDesc *queryDesc)
Definition: explain.c:724
void pfree(void *pointer)
Definition: mcxt.c:1056
void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
Definition: explain.c:681
void ExplainBeginOutput(ExplainState *es)
Definition: explain.c:3772
void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc)
Definition: explain.c:899
#define ereport(elevel, rest)
Definition: elog.h:141
bool timing
Definition: explain.h:36
static int auto_explain_log_min_duration
Definition: auto_explain.c:26
static bool auto_explain_log_timing
Definition: auto_explain.c:31
static bool auto_explain_log_analyze
Definition: auto_explain.c:27
bool verbose
Definition: explain.h:32
struct Instrumentation * totaltime
Definition: execdesc.h:55
static ExecutorEnd_hook_type prev_ExecutorEnd
Definition: auto_explain.c:75
ExplainFormat format
Definition: explain.h:39
int errmsg(const char *fmt,...)
Definition: elog.c:784
bool buffers
Definition: explain.h:35
void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc)
Definition: explain.c:770
static bool auto_explain_log_settings
Definition: auto_explain.c:32
StringInfo str
Definition: explain.h:30
bool settings
Definition: explain.h:38
static bool auto_explain_log_triggers
Definition: auto_explain.c:30

◆ explain_ExecutorFinish()

static void explain_ExecutorFinish ( QueryDesc queryDesc)
static

Definition at line 337 of file auto_explain.c.

References nesting_level, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, prev_ExecutorFinish, and standard_ExecutorFinish().

Referenced by _PG_init().

338 {
339  nesting_level++;
340  PG_TRY();
341  {
343  prev_ExecutorFinish(queryDesc);
344  else
345  standard_ExecutorFinish(queryDesc);
346  nesting_level--;
347  }
348  PG_CATCH();
349  {
350  nesting_level--;
351  PG_RE_THROW();
352  }
353  PG_END_TRY();
354 }
void standard_ExecutorFinish(QueryDesc *queryDesc)
Definition: execMain.c:411
static int nesting_level
Definition: auto_explain.c:61
static ExecutorFinish_hook_type prev_ExecutorFinish
Definition: auto_explain.c:74
#define PG_CATCH()
Definition: elog.h:310
#define PG_RE_THROW()
Definition: elog.h:331
#define PG_TRY()
Definition: elog.h:301
#define PG_END_TRY()
Definition: elog.h:317

◆ explain_ExecutorRun()

static void explain_ExecutorRun ( QueryDesc queryDesc,
ScanDirection  direction,
uint64  count,
bool  execute_once 
)
static

Definition at line 313 of file auto_explain.c.

References nesting_level, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, prev_ExecutorRun, and standard_ExecutorRun().

Referenced by _PG_init().

315 {
316  nesting_level++;
317  PG_TRY();
318  {
319  if (prev_ExecutorRun)
320  prev_ExecutorRun(queryDesc, direction, count, execute_once);
321  else
322  standard_ExecutorRun(queryDesc, direction, count, execute_once);
323  nesting_level--;
324  }
325  PG_CATCH();
326  {
327  nesting_level--;
328  PG_RE_THROW();
329  }
330  PG_END_TRY();
331 }
void standard_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once)
Definition: execMain.c:312
static ExecutorRun_hook_type prev_ExecutorRun
Definition: auto_explain.c:73
static int nesting_level
Definition: auto_explain.c:61
#define PG_CATCH()
Definition: elog.h:310
#define PG_RE_THROW()
Definition: elog.h:331
#define PG_TRY()
Definition: elog.h:301
#define PG_END_TRY()
Definition: elog.h:317

◆ explain_ExecutorStart()

static void explain_ExecutorStart ( QueryDesc queryDesc,
int  eflags 
)
static

Definition at line 251 of file auto_explain.c.

References auto_explain_enabled, auto_explain_log_analyze, auto_explain_log_buffers, auto_explain_log_min_duration, auto_explain_log_timing, auto_explain_sample_rate, current_query_sampled, EState::es_query_cxt, QueryDesc::estate, EXEC_FLAG_EXPLAIN_ONLY, InstrAlloc(), INSTRUMENT_ALL, INSTRUMENT_BUFFERS, QueryDesc::instrument_options, INSTRUMENT_ROWS, INSTRUMENT_TIMER, IsParallelWorker, MAX_RANDOM_VALUE, MemoryContextSwitchTo(), nesting_level, prev_ExecutorStart, random(), standard_ExecutorStart(), and QueryDesc::totaltime.

Referenced by _PG_init().

252 {
253  /*
254  * At the beginning of each top-level statement, decide whether we'll
255  * sample this statement. If nested-statement explaining is enabled,
256  * either all nested statements will be explained or none will.
257  *
258  * When in a parallel worker, we should do nothing, which we can implement
259  * cheaply by pretending we decided not to sample the current statement.
260  * If EXPLAIN is active in the parent session, data will be collected and
261  * reported back to the parent, and it's no business of ours to interfere.
262  */
263  if (nesting_level == 0)
264  {
267  ((double) MAX_RANDOM_VALUE + 1));
268  else
269  current_query_sampled = false;
270  }
271 
272  if (auto_explain_enabled())
273  {
274  /* Enable per-node instrumentation iff log_analyze is required. */
275  if (auto_explain_log_analyze && (eflags & EXEC_FLAG_EXPLAIN_ONLY) == 0)
276  {
278  queryDesc->instrument_options |= INSTRUMENT_TIMER;
279  else
280  queryDesc->instrument_options |= INSTRUMENT_ROWS;
283  }
284  }
285 
286  if (prev_ExecutorStart)
287  prev_ExecutorStart(queryDesc, eflags);
288  else
289  standard_ExecutorStart(queryDesc, eflags);
290 
291  if (auto_explain_enabled())
292  {
293  /*
294  * Set up to track total elapsed time in ExecutorRun. Make sure the
295  * space is allocated in the per-query context so it will go away at
296  * ExecutorEnd.
297  */
298  if (queryDesc->totaltime == NULL)
299  {
300  MemoryContext oldcxt;
301 
302  oldcxt = MemoryContextSwitchTo(queryDesc->estate->es_query_cxt);
303  queryDesc->totaltime = InstrAlloc(1, INSTRUMENT_ALL);
304  MemoryContextSwitchTo(oldcxt);
305  }
306  }
307 }
static double auto_explain_sample_rate
Definition: auto_explain.c:36
static bool current_query_sampled
Definition: auto_explain.c:64
EState * estate
Definition: execdesc.h:48
long random(void)
Definition: random.c:22
static bool auto_explain_log_buffers
Definition: auto_explain.c:29
void standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
Definition: execMain.c:152
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
Instrumentation * InstrAlloc(int n, int instrument_options)
Definition: instrument.c:30
int instrument_options
Definition: execdesc.h:44
static ExecutorStart_hook_type prev_ExecutorStart
Definition: auto_explain.c:72
#define auto_explain_enabled()
Definition: auto_explain.c:66
MemoryContext es_query_cxt
Definition: execnodes.h:550
static int nesting_level
Definition: auto_explain.c:61
#define MAX_RANDOM_VALUE
#define IsParallelWorker()
Definition: parallel.h:60
static int auto_explain_log_min_duration
Definition: auto_explain.c:26
static bool auto_explain_log_timing
Definition: auto_explain.c:31
static bool auto_explain_log_analyze
Definition: auto_explain.c:27
struct Instrumentation * totaltime
Definition: execdesc.h:55
#define EXEC_FLAG_EXPLAIN_ONLY
Definition: executor.h:56

Variable Documentation

◆ auto_explain_log_analyze

bool auto_explain_log_analyze = false
static

Definition at line 27 of file auto_explain.c.

Referenced by _PG_init(), explain_ExecutorEnd(), and explain_ExecutorStart().

◆ auto_explain_log_buffers

bool auto_explain_log_buffers = false
static

Definition at line 29 of file auto_explain.c.

Referenced by _PG_init(), explain_ExecutorEnd(), and explain_ExecutorStart().

◆ auto_explain_log_format

int auto_explain_log_format = EXPLAIN_FORMAT_TEXT
static

Definition at line 33 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorEnd().

◆ auto_explain_log_level

int auto_explain_log_level = LOG
static

Definition at line 34 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorEnd().

◆ auto_explain_log_min_duration

int auto_explain_log_min_duration = -1
static

Definition at line 26 of file auto_explain.c.

Referenced by _PG_init(), explain_ExecutorEnd(), and explain_ExecutorStart().

◆ auto_explain_log_nested_statements

bool auto_explain_log_nested_statements = false
static

Definition at line 35 of file auto_explain.c.

Referenced by _PG_init().

◆ auto_explain_log_settings

bool auto_explain_log_settings = false
static

Definition at line 32 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorEnd().

◆ auto_explain_log_timing

bool auto_explain_log_timing = true
static

Definition at line 31 of file auto_explain.c.

Referenced by _PG_init(), explain_ExecutorEnd(), and explain_ExecutorStart().

◆ auto_explain_log_triggers

bool auto_explain_log_triggers = false
static

Definition at line 30 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorEnd().

◆ auto_explain_log_verbose

bool auto_explain_log_verbose = false
static

Definition at line 28 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorEnd().

◆ auto_explain_sample_rate

double auto_explain_sample_rate = 1
static

Definition at line 36 of file auto_explain.c.

Referenced by _PG_init(), and explain_ExecutorStart().

◆ current_query_sampled

bool current_query_sampled = false
static

Definition at line 64 of file auto_explain.c.

Referenced by explain_ExecutorStart().

◆ format_options

const struct config_enum_entry format_options[]
static
Initial value:
= {
{"text", EXPLAIN_FORMAT_TEXT, false},
{"xml", EXPLAIN_FORMAT_XML, false},
{"json", EXPLAIN_FORMAT_JSON, false},
{"yaml", EXPLAIN_FORMAT_YAML, false},
{NULL, 0, false}
}

Definition at line 38 of file auto_explain.c.

◆ loglevel_options

const struct config_enum_entry loglevel_options[]
static
Initial value:
= {
{"debug5", DEBUG5, false},
{"debug4", DEBUG4, false},
{"debug3", DEBUG3, false},
{"debug2", DEBUG2, false},
{"debug1", DEBUG1, false},
{"debug", DEBUG2, true},
{"info", INFO, false},
{"notice", NOTICE, false},
{"warning", WARNING, false},
{"log", LOG, false},
{NULL, 0, false}
}
#define DEBUG1
Definition: elog.h:25
#define DEBUG3
Definition: elog.h:23
#define INFO
Definition: elog.h:33
#define LOG
Definition: elog.h:26
#define DEBUG4
Definition: elog.h:22
#define DEBUG2
Definition: elog.h:24
#define WARNING
Definition: elog.h:40
#define NOTICE
Definition: elog.h:37
#define DEBUG5
Definition: elog.h:20

Definition at line 46 of file auto_explain.c.

◆ nesting_level

int nesting_level = 0
static

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 23 of file auto_explain.c.

◆ prev_ExecutorEnd

ExecutorEnd_hook_type prev_ExecutorEnd = NULL
static

Definition at line 75 of file auto_explain.c.

Referenced by _PG_fini(), _PG_init(), and explain_ExecutorEnd().

◆ prev_ExecutorFinish

ExecutorFinish_hook_type prev_ExecutorFinish = NULL
static

Definition at line 74 of file auto_explain.c.

Referenced by _PG_fini(), _PG_init(), and explain_ExecutorFinish().

◆ prev_ExecutorRun

ExecutorRun_hook_type prev_ExecutorRun = NULL
static

Definition at line 73 of file auto_explain.c.

Referenced by _PG_fini(), _PG_init(), and explain_ExecutorRun().

◆ prev_ExecutorStart

ExecutorStart_hook_type prev_ExecutorStart = NULL
static

Definition at line 72 of file auto_explain.c.

Referenced by _PG_fini(), _PG_init(), and explain_ExecutorStart().