execParallel.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*--------------------------------------------------------------------
  2. * execParallel.h
  3. * POSTGRES parallel execution interface
  4. *
  5. * Portions Copyright (c) 1996-2022, 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. #ifndef EXECPARALLEL_H
  13. #define EXECPARALLEL_H
  14. #include "access/parallel.h"
  15. #include "nodes/execnodes.h"
  16. #include "nodes/parsenodes.h"
  17. #include "nodes/plannodes.h"
  18. #include "utils/dsa.h"
  19. typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation;
  20. typedef struct ParallelExecutorInfo
  21. {
  22. PlanState *planstate; /* plan subtree we're running in parallel */
  23. ParallelContext *pcxt; /* parallel context we're using */
  24. BufferUsage *buffer_usage; /* points to bufusage area in DSM */
  25. WalUsage *wal_usage; /* walusage area in DSM */
  26. SharedExecutorInstrumentation *instrumentation; /* optional */
  27. struct SharedJitInstrumentation *jit_instrumentation; /* optional */
  28. dsa_area *area; /* points to DSA area in DSM */
  29. dsa_pointer param_exec; /* serialized PARAM_EXEC parameters */
  30. bool finished; /* set true by ExecParallelFinish */
  31. /* These two arrays have pcxt->nworkers_launched entries: */
  32. shm_mq_handle **tqueue; /* tuple queues for worker output */
  33. struct TupleQueueReader **reader; /* tuple reader/writer support */
  34. } ParallelExecutorInfo;
  35. extern ParallelExecutorInfo *ExecInitParallelPlan(PlanState *planstate,
  36. EState *estate, Bitmapset *sendParam, int nworkers,
  37. int64 tuples_needed);
  38. extern void ExecParallelCreateReaders(ParallelExecutorInfo *pei);
  39. extern void ExecParallelFinish(ParallelExecutorInfo *pei);
  40. extern void ExecParallelCleanup(ParallelExecutorInfo *pei);
  41. extern void ExecParallelReinitialize(PlanState *planstate,
  42. ParallelExecutorInfo *pei, Bitmapset *sendParam);
  43. extern void ParallelQueryMain(dsm_segment *seg, shm_toc *toc);
  44. #endif /* EXECPARALLEL_H */