Skip to content

Commit 8d5ceb1

Browse files
committed
pg_overexplain: Additional EXPLAIN options for debugging.
There's a fair amount of information in the Plan and PlanState trees that isn't printed by any existing EXPLAIN option. This means that, when working on the planner, it's often necessary to rely on facilities such as debug_print_plan, which produce excessively voluminous output. Hence, use the new EXPLAIN extension facilities to implement EXPLAIN (DEBUG) and EXPLAIN (RANGE_TABLE) as extensions to the core EXPLAIN facility. A great deal more could be done here, and the specific choices about what to print and how are definitely arguable, but this is at least a starting point for discussion and a jumping-off point for possible future improvements. Reviewed-by: Sami Imseih <samimseih@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviweed-by: Andrei Lepikhov <lepihov@gmail.com> (who didn't like it) Discussion: http://postgr.es/m/CA+TgmoZfvQUBWQ2P8iO30jywhfEAKyNzMZSR+uc2xr9PZBw6eQ@mail.gmail.com
1 parent 8182455 commit 8d5ceb1

File tree

12 files changed

+1595
-0
lines changed

12 files changed

+1595
-0
lines changed

contrib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ SUBDIRS = \
3333
pg_buffercache \
3434
pg_freespacemap \
3535
pg_logicalinspect \
36+
pg_overexplain \
3637
pg_prewarm \
3738
pg_stat_statements \
3839
pg_surgery \

contrib/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ subdir('pg_buffercache')
4747
subdir('pgcrypto')
4848
subdir('pg_freespacemap')
4949
subdir('pg_logicalinspect')
50+
subdir('pg_overexplain')
5051
subdir('pg_prewarm')
5152
subdir('pgrowlocks')
5253
subdir('pg_stat_statements')

contrib/pg_overexplain/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated subdirectories
2+
/log/
3+
/results/
4+
/tmp_check/

contrib/pg_overexplain/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# contrib/pg_overexplain/Makefile
2+
3+
MODULE_big = pg_overexplain
4+
OBJS = \
5+
$(WIN32RES) \
6+
pg_overexplain.o
7+
8+
PGFILEDESC = "pg_overexplain - allow EXPLAIN to dump even more details"
9+
10+
REGRESS = pg_overexplain
11+
12+
ifdef USE_PGXS
13+
PG_CONFIG = pg_config
14+
PGXS := $(shell $(PG_CONFIG) --pgxs)
15+
include $(PGXS)
16+
else
17+
subdir = contrib/pg_overexplain
18+
top_builddir = ../..
19+
include $(top_builddir)/src/Makefile.global
20+
include $(top_srcdir)/contrib/contrib-global.mk
21+
endif

contrib/pg_overexplain/expected/pg_overexplain.out

Lines changed: 483 additions & 0 deletions
Large diffs are not rendered by default.

contrib/pg_overexplain/meson.build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2022-2025, PostgreSQL Global Development Group
2+
3+
pg_overexplain_sources = files(
4+
'pg_overexplain.c',
5+
)
6+
7+
if host_system == 'windows'
8+
pg_overexplain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
9+
'--NAME', 'pg_overexplain',
10+
'--FILEDESC', 'pg_overexplain - allow EXPLAIN to dump even more details',])
11+
endif
12+
13+
pg_overexplain = shared_module('pg_overexplain',
14+
pg_overexplain_sources,
15+
kwargs: contrib_mod_args,
16+
)
17+
contrib_targets += pg_overexplain
18+
19+
tests += {
20+
'name': 'pg_overexplain',
21+
'sd': meson.current_source_dir(),
22+
'bd': meson.current_build_dir(),
23+
'regress': {
24+
'sql': [
25+
'pg_overexplain',
26+
],
27+
},
28+
}

0 commit comments

Comments
 (0)