1 /*--------------------------------------------------------------------
3 * POSTGRES parallel execution interface
5 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
6 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/executor/execParallel.h
10 *--------------------------------------------------------------------
13 #ifndef EXECPARALLEL_H
14 #define EXECPARALLEL_H
16 #include "access/parallel.h"
17 #include "nodes/execnodes.h"
18 #include "nodes/parsenodes.h"
19 #include "nodes/plannodes.h"
20 #include "utils/dsa.h"
22 typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation
;
24 typedef struct ParallelExecutorInfo
26 PlanState
*planstate
; /* plan subtree we're running in parallel */
27 ParallelContext
*pcxt
; /* parallel context we're using */
28 BufferUsage
*buffer_usage
; /* points to bufusage area in DSM */
29 WalUsage
*wal_usage
; /* walusage area in DSM */
30 SharedExecutorInstrumentation
*instrumentation
; /* optional */
31 struct SharedJitInstrumentation
*jit_instrumentation
; /* optional */
32 dsa_area
*area
; /* points to DSA area in DSM */
33 dsa_pointer param_exec
; /* serialized PARAM_EXEC parameters */
34 bool finished
; /* set true by ExecParallelFinish */
35 /* These two arrays have pcxt->nworkers_launched entries: */
36 shm_mq_handle
**tqueue
; /* tuple queues for worker output */
37 struct TupleQueueReader
**reader
; /* tuple reader/writer support */
38 } ParallelExecutorInfo
;
40 extern ParallelExecutorInfo
*ExecInitParallelPlan(PlanState
*planstate
,
41 EState
*estate
, Bitmapset
*sendParams
, int nworkers
,
43 extern void ExecParallelCreateReaders(ParallelExecutorInfo
*pei
);
44 extern void ExecParallelFinish(ParallelExecutorInfo
*pei
);
45 extern void ExecParallelCleanup(ParallelExecutorInfo
*pei
);
46 extern void ExecParallelReinitialize(PlanState
*planstate
,
47 ParallelExecutorInfo
*pei
, Bitmapset
*sendParams
);
49 extern void ParallelQueryMain(dsm_segment
*seg
, shm_toc
*toc
);
51 #endif /* EXECPARALLEL_H */