2 F.29. pg_overexplain — allow EXPLAIN to dump even more details #
4 F.29.1. EXPLAIN (DEBUG)
5 F.29.2. EXPLAIN (RANGE_TABLE)
8 The pg_overexplain module extends EXPLAIN with new options that provide
9 additional output. It is mostly intended to assist with debugging of
10 and development of the planner, rather than for general use. Since this
11 module displays internal details of planner data structures, it may be
12 necessary to refer to the source code to make sense of the output.
13 Furthermore, the output is likely to change whenever (and as often as)
14 those data structures change.
16 To use it, simply load it into the server. You can load it into an
18 LOAD 'pg_overexplain';
20 You can also preload it into some or all sessions by including
21 pg_overexplain in session_preload_libraries or shared_preload_libraries
24 F.29.1. EXPLAIN (DEBUG) #
26 The DEBUG option displays miscellaneous information from the plan tree
27 that is not normally shown because it is not expected to be of general
28 interest. For each individual plan node, it will display the following
29 fields. See Plan in nodes/plannodes.h for additional documentation of
31 * Disabled Nodes. Normal EXPLAIN determines whether a node is
32 disabled by checking whether the node's count of disabled nodes is
33 larger than the sum of the counts for the underlying nodes. This
34 option shows the raw counter value.
35 * Parallel Safe. Indicates whether it would be safe for a plan tree
36 node to appear beneath a Gather or Gather Merge node, regardless of
37 whether it is actually below such a node.
38 * Plan Node ID. An internal ID number that should be unique for every
39 node in the plan tree. It is used to coordinate parallel query
41 * extParam and allParam. Information about which numbered parameters
42 affect this plan node or its children. In text mode, these fields
43 are only displayed if they are non-empty sets.
45 Once per query, the DEBUG option will display the following fields. See
46 PlannedStmt in nodes/plannodes.h for additional detail.
47 * Command Type. For example, select or update.
48 * Flags. A comma-separated list of Boolean structure member names
49 from the PlannedStmt that are set to true. It covers the following
50 structure members: hasReturning, hasModifyingCTE, canSetTag,
51 transientPlan, dependsOnRole, parallelModeNeeded.
52 * Subplans Needing Rewind. Integer IDs of subplans that may need to
53 be rewound by the executor.
54 * Relation OIDs. OIDs of relations upon which this plan depends.
55 * Executor Parameter Types. Type OID for each executor parameter
56 (e.g. when a nested loop is chosen and a parameter is used to pass
57 a value down to an inner index scan). Does not include parameters
58 supplied to a prepared statement by the user.
59 * Parse Location. Location within the query string supplied to the
60 planner where this query's text can be found. May be Unknown in
61 some contexts. Otherwise, may be NNN to end for some integer NNN or
62 NNN for MMM bytes for some integers NNN and MMM.
64 F.29.2. EXPLAIN (RANGE_TABLE) #
66 The RANGE_TABLE option displays information from the plan tree
67 specifically concerning the query's range table. Range table entries
68 correspond roughly to items appearing in the query's FROM clause, but
69 with numerous exceptions. For example, subqueries that are proved
70 unnecessary may be deleted from the range table entirely, while
71 inheritance expansion adds range table entries for child tables that
72 are not named directly in the query.
74 Range table entries are generally referenced within the query plan by a
75 range table index, or RTI. Plan nodes that reference one or more RTIs
76 will be labelled accordingly, using one of the following fields: Scan
77 RTI, Nominal RTI, Exclude Relation RTI, Append RTIs.
79 In addition, the query as a whole may maintain lists of range table
80 indexes that are needed for various purposes. These lists will be
81 displayed once per query, labelled as appropriate as Unprunable RTIs or
82 Result RTIs. In text mode, these fields are only displayed if they are
85 Finally, but most importantly, the RANGE_TABLE option will display a
86 dump of the query's entire range table. Each range table entry is
87 labelled with the appropriate range table index, the kind of range
88 table entry (e.g. relation, subquery, or join), followed by the
89 contents of various range table entry fields that are not normally part
90 of EXPLAIN output. Some of these fields are only displayed for certain
91 kinds of range table entries. For example, Eref is displayed for all
92 types of range table entries, but CTE Name is displayed only for range
93 table entries of type cte.
95 For more information about range table entries, see the definition of
96 RangeTblEntry in nodes/plannodes.h.
100 Robert Haas <rhaas@postgresql.org>