1 /*-------------------------------------------------------------------- 2 * execParallel.h 3 * POSTGRES parallel execution interface 4 * 5 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group 6 * Portions Copyright (c) 1994, Regents of the University of California 7 * 8 * IDENTIFICATION 9 * src/include/executor/execParallel.h 10 *-------------------------------------------------------------------- 11 */ 12 13 #ifndef EXECPARALLEL_H 14 #define EXECPARALLEL_H 15 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" 21 22 typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation; 23 24 typedef struct ParallelExecutorInfo 25 { 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 SharedExecutorInstrumentation *instrumentation; /* optional */ 30 struct SharedJitInstrumentation *jit_instrumentation; /* optional */ 31 dsa_area *area; /* points to DSA area in DSM */ 32 dsa_pointer param_exec; /* serialized PARAM_EXEC parameters */ 33 bool finished; /* set true by ExecParallelFinish */ 34 /* These two arrays have pcxt->nworkers_launched entries: */ 35 shm_mq_handle **tqueue; /* tuple queues for worker output */ 36 struct TupleQueueReader **reader; /* tuple reader/writer support */ 37 } ParallelExecutorInfo; 38 39 extern ParallelExecutorInfo *ExecInitParallelPlan(PlanState *planstate, 40 EState *estate, Bitmapset *sendParam, int nworkers, 41 int64 tuples_needed); 42 extern void ExecParallelCreateReaders(ParallelExecutorInfo *pei); 43 extern void ExecParallelFinish(ParallelExecutorInfo *pei); 44 extern void ExecParallelCleanup(ParallelExecutorInfo *pei); 45 extern void ExecParallelReinitialize(PlanState *planstate, 46 ParallelExecutorInfo *pei, Bitmapset *sendParam); 47 48 extern void ParallelQueryMain(dsm_segment *seg, shm_toc *toc); 49 50 #endif /* EXECPARALLEL_H */ 51