PostgreSQL Source Code git master
Loading...
Searching...
No Matches
instrument_node.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * instrument_node.h
4 * Definitions for node-specific support for parallel query instrumentation
5 *
6 * These structs purposely contain no pointers because they are copied
7 * across processes during parallel query execution. Each worker copies its
8 * individual information into the container struct at executor shutdown time,
9 * to allow the leader to display the information in EXPLAIN ANALYZE.
10 *
11 * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
12 * Portions Copyright (c) 1994, Regents of the University of California
13 *
14 * src/include/executor/instrument_node.h
15 *
16 *-------------------------------------------------------------------------
17 */
18#ifndef INSTRUMENT_NODE_H
19#define INSTRUMENT_NODE_H
20
21
22/* ---------------------
23 * Instrumentation information for aggregate function execution
24 * ---------------------
25 */
27{
28 Size hash_mem_peak; /* peak hash table memory usage */
29 uint64 hash_disk_used; /* kB of disk space used */
30 int hash_batches_used; /* batches used during entire execution */
32
33/*
34 * Shared memory container for per-worker aggregate information
35 */
41
42
43/* ---------------------
44 * Instrumentation information for indexscans (amgettuple and amgetbitmap)
45 * ---------------------
46 */
48{
49 /* Index search count (incremented with pgstat_count_index_scan call) */
52
53/*
54 * Shared memory container for per-worker information
55 */
61
62
63/* ---------------------
64 * Instrumentation information for bitmap heap scans
65 *
66 * exact_pages total number of exact pages retrieved
67 * lossy_pages total number of lossy pages retrieved
68 * ---------------------
69 */
75
76/*
77 * Shared memory container for per-worker information
78 */
84
85
86/* ---------------------
87 * Instrumentation information for Memoize
88 * ---------------------
89 */
91{
92 uint64 cache_hits; /* number of rescans where we've found the
93 * scan parameters values to be cached */
94 uint64 cache_misses; /* number of rescans where we've not found the
95 * scan parameters values to be cached */
96 uint64 cache_evictions; /* number of cache entries removed due to
97 * the need to free memory */
98 uint64 cache_overflows; /* number of times we've had to bypass the
99 * cache when filling it due to not being
100 * able to free enough space to store the
101 * current scan's tuples */
102 uint64 mem_peak; /* peak memory usage in bytes */
104
105/*
106 * Shared memory container for per-worker memoize information
107 */
113
114
115/* ---------------------
116 * Instrumentation information for Sorts.
117 * ---------------------
118 */
119
125
126/*
127 * The parallel-sort infrastructure relies on having a zero TuplesortMethod
128 * to indicate that a worker never did anything, so we assign zero to
129 * SORT_TYPE_STILL_IN_PROGRESS. The other values of this enum can be
130 * OR'ed together to represent a situation where different workers used
131 * different methods, so we need a separate bit for each one. Keep the
132 * NUM_TUPLESORTMETHODS constant in sync with the number of bits!
133 */
142#define NUM_TUPLESORTMETHODS 4
143
145{
146 TuplesortMethod sortMethod; /* sort algorithm used */
147 TuplesortSpaceType spaceType; /* type of space spaceUsed represents */
148 int64 spaceUsed; /* space consumption, in kB */
150
151/*
152 * Shared memory container for per-worker sort information
153 */
159
160
161/* ---------------------
162 * Instrumentation information for nodeHash.c
163 * ---------------------
164 */
166{
167 int nbuckets; /* number of buckets at end of execution */
168 int nbuckets_original; /* planned number of buckets */
169 int nbatch; /* number of batches at end of execution */
170 int nbatch_original; /* planned number of batches */
171 Size space_peak; /* peak memory usage in bytes */
173
174/*
175 * Shared memory container for per-worker information
176 */
182
183
184/* ---------------------
185 * Instrumentation information for IncrementalSort
186 * ---------------------
187 */
197
203
204/* Shared memory container for per-worker incremental sort information */
210
211#endif /* INSTRUMENT_NODE_H */
int64_t int64
Definition c.h:543
#define FLEXIBLE_ARRAY_MEMBER
Definition c.h:480
uint32 bits32
Definition c.h:555
uint64_t uint64
Definition c.h:547
size_t Size
Definition c.h:619
TuplesortSpaceType
@ SORT_SPACE_TYPE_DISK
@ SORT_SPACE_TYPE_MEMORY
TuplesortMethod
@ SORT_TYPE_EXTERNAL_SORT
@ SORT_TYPE_TOP_N_HEAPSORT
@ SORT_TYPE_QUICKSORT
@ SORT_TYPE_STILL_IN_PROGRESS
@ SORT_TYPE_EXTERNAL_MERGE
IncrementalSortGroupInfo prefixsortGroupInfo
IncrementalSortGroupInfo fullsortGroupInfo
AggregateInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
BitmapHeapScanInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
HashInstrumentation hinstrument[FLEXIBLE_ARRAY_MEMBER]
IncrementalSortInfo sinfo[FLEXIBLE_ARRAY_MEMBER]
IndexScanInstrumentation winstrument[FLEXIBLE_ARRAY_MEMBER]
MemoizeInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
TuplesortInstrumentation sinstrument[FLEXIBLE_ARRAY_MEMBER]
TuplesortSpaceType spaceType