PostgreSQL Source Code git master
|
#include "postgres.h"
#include "executor/executor.h"
#include "executor/execParallel.h"
#include "executor/nodeGatherMerge.h"
#include "executor/tqueue.h"
#include "lib/binaryheap.h"
#include "miscadmin.h"
#include "optimizer/optimizer.h"
Go to the source code of this file.
Data Structures | |
struct | GMReaderTupleBuffer |
Macros | |
#define | MAX_TUPLE_STORE 10 |
Typedefs | |
typedef struct GMReaderTupleBuffer | GMReaderTupleBuffer |
typedef int32 | SlotNumber |
Functions | |
static TupleTableSlot * | ExecGatherMerge (PlanState *pstate) |
static int32 | heap_compare_slots (Datum a, Datum b, void *arg) |
static TupleTableSlot * | gather_merge_getnext (GatherMergeState *gm_state) |
static MinimalTuple | gm_readnext_tuple (GatherMergeState *gm_state, int nreader, bool nowait, bool *done) |
static void | ExecShutdownGatherMergeWorkers (GatherMergeState *node) |
static void | gather_merge_setup (GatherMergeState *gm_state) |
static void | gather_merge_init (GatherMergeState *gm_state) |
static void | gather_merge_clear_tuples (GatherMergeState *gm_state) |
static bool | gather_merge_readnext (GatherMergeState *gm_state, int reader, bool nowait) |
static void | load_tuple_array (GatherMergeState *gm_state, int reader) |
GatherMergeState * | ExecInitGatherMerge (GatherMerge *node, EState *estate, int eflags) |
void | ExecEndGatherMerge (GatherMergeState *node) |
void | ExecShutdownGatherMerge (GatherMergeState *node) |
void | ExecReScanGatherMerge (GatherMergeState *node) |
#define MAX_TUPLE_STORE 10 |
Definition at line 31 of file nodeGatherMerge.c.
typedef struct GMReaderTupleBuffer GMReaderTupleBuffer |
typedef int32 SlotNumber |
Definition at line 746 of file nodeGatherMerge.c.
void ExecEndGatherMerge | ( | GatherMergeState * | node | ) |
Definition at line 291 of file nodeGatherMerge.c.
References ExecEndNode(), ExecShutdownGatherMerge(), and outerPlanState.
Referenced by ExecEndNode().
|
static |
Definition at line 183 of file nodeGatherMerge.c.
References castNode, CHECK_FOR_INTERRUPTS, ExprContext::ecxt_outertuple, EState::es_parallel_workers_launched, EState::es_parallel_workers_to_launch, EState::es_use_parallel_mode, ExecInitParallelPlan(), ExecParallelCreateReaders(), ExecParallelReinitialize(), ExecProject(), gather_merge_getnext(), GatherMergeState::initialized, GatherMerge::initParam, LaunchParallelWorkers(), GatherMergeState::need_to_scan_locally, GatherMergeState::nreaders, GatherMerge::num_workers, ParallelContext::nworkers_launched, GatherMergeState::nworkers_launched, ParallelContext::nworkers_to_launch, outerPlanState, palloc(), parallel_leader_participation, ParallelExecutorInfo::pcxt, GatherMergeState::pei, PlanState::plan, GatherMergeState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, ParallelExecutorInfo::reader, GatherMergeState::reader, ResetExprContext, PlanState::state, TupIsNull, and GatherMergeState::tuples_needed.
Referenced by ExecInitGatherMerge().
GatherMergeState * ExecInitGatherMerge | ( | GatherMerge * | node, |
EState * | estate, | ||
int | eflags | ||
) |
Definition at line 67 of file nodeGatherMerge.c.
References SortSupportData::abbreviate, Assert, CurrentMemoryContext, ExecAssignExprContext(), ExecConditionalAssignProjectionInfo(), ExecGatherMerge(), ExecGetResultType(), ExecInitNode(), ExecInitResultTypeTL(), PlanState::ExecProcNode, gather_merge_setup(), GatherMergeState::gm_initialized, GatherMergeState::gm_nkeys, GatherMergeState::gm_sortkeys, i, GatherMergeState::initialized, innerPlan, makeNode, GatherMerge::numCols, OUTER_VAR, PlanState::outeropsfixed, PlanState::outeropsset, outerPlan, outerPlanState, palloc0(), PlanState::plan, GatherMerge::plan, PrepareSortSupportFromOrderingOp(), GatherMergeState::ps, PlanState::ps_ProjInfo, Plan::qual, PlanState::resultopsfixed, PlanState::resultopsset, SortSupportData::ssup_attno, SortSupportData::ssup_collation, SortSupportData::ssup_cxt, SortSupportData::ssup_nulls_first, PlanState::state, GatherMergeState::tupDesc, and GatherMergeState::tuples_needed.
Referenced by ExecInitNode().
void ExecReScanGatherMerge | ( | GatherMergeState * | node | ) |
Definition at line 341 of file nodeGatherMerge.c.
References bms_add_member(), ExecReScan(), ExecShutdownGatherMergeWorkers(), gather_merge_clear_tuples(), GatherMergeState::gm_initialized, GatherMergeState::initialized, outerPlan, outerPlanState, PlanState::plan, GatherMergeState::ps, and GatherMerge::rescan_param.
Referenced by ExecReScan().
void ExecShutdownGatherMerge | ( | GatherMergeState * | node | ) |
Definition at line 304 of file nodeGatherMerge.c.
References ExecParallelCleanup(), ExecShutdownGatherMergeWorkers(), and GatherMergeState::pei.
Referenced by ExecEndGatherMerge(), and ExecShutdownNode_walker().
|
static |
Definition at line 323 of file nodeGatherMerge.c.
References ExecParallelFinish(), GatherMergeState::pei, pfree(), and GatherMergeState::reader.
Referenced by ExecReScanGatherMerge(), and ExecShutdownGatherMerge().
|
static |
Definition at line 526 of file nodeGatherMerge.c.
References ExecClearTuple(), GatherMergeState::gm_slots, GatherMergeState::gm_tuple_buffers, i, GatherMergeState::nreaders, GMReaderTupleBuffer::nTuples, pfree(), GMReaderTupleBuffer::readCounter, and GMReaderTupleBuffer::tuple.
Referenced by ExecReScanGatherMerge(), and gather_merge_getnext().
|
static |
Definition at line 547 of file nodeGatherMerge.c.
References binaryheap_empty, binaryheap_first(), binaryheap_remove_first(), binaryheap_replace_first(), DatumGetInt32(), gather_merge_clear_tuples(), gather_merge_init(), gather_merge_readnext(), GatherMergeState::gm_heap, GatherMergeState::gm_initialized, GatherMergeState::gm_slots, i, and Int32GetDatum().
Referenced by ExecGatherMerge().
|
static |
Definition at line 443 of file nodeGatherMerge.c.
References Assert, binaryheap_add_unordered(), binaryheap_build(), binaryheap_reset(), castNode, CHECK_FOR_INTERRUPTS, GMReaderTupleBuffer::done, ExecClearTuple(), gather_merge_readnext(), GatherMergeState::gm_heap, GatherMergeState::gm_initialized, GatherMergeState::gm_slots, GatherMergeState::gm_tuple_buffers, i, Int32GetDatum(), load_tuple_array(), GatherMergeState::need_to_scan_locally, GatherMergeState::nreaders, GMReaderTupleBuffer::nTuples, PlanState::plan, GatherMergeState::ps, GMReaderTupleBuffer::readCounter, and TupIsNull.
Referenced by gather_merge_getnext().
|
static |
Definition at line 636 of file nodeGatherMerge.c.
References ParallelExecutorInfo::area, Assert, GMReaderTupleBuffer::done, EState::es_query_dsa, ExecProcNode(), ExecStoreMinimalTuple(), gm_readnext_tuple(), GatherMergeState::gm_slots, GatherMergeState::gm_tuple_buffers, load_tuple_array(), GatherMergeState::need_to_scan_locally, GMReaderTupleBuffer::nTuples, outerPlan, outerPlanState, GatherMergeState::pei, GatherMergeState::ps, GMReaderTupleBuffer::readCounter, PlanState::state, TupIsNull, and GMReaderTupleBuffer::tuple.
Referenced by gather_merge_getnext(), and gather_merge_init().
|
static |
Definition at line 395 of file nodeGatherMerge.c.
References binaryheap_allocate(), castNode, ExecInitExtraTupleSlot(), GatherMergeState::gm_heap, GatherMergeState::gm_slots, GatherMergeState::gm_tuple_buffers, heap_compare_slots(), i, MAX_TUPLE_STORE, GatherMerge::num_workers, palloc0(), PlanState::plan, GatherMergeState::ps, PlanState::state, TTSOpsMinimalTuple, GatherMergeState::tupDesc, and GMReaderTupleBuffer::tuple.
Referenced by ExecInitGatherMerge().
|
static |
Definition at line 714 of file nodeGatherMerge.c.
References CHECK_FOR_INTERRUPTS, heap_copy_minimal_tuple(), GatherMergeState::reader, and TupleQueueReaderNext().
Referenced by gather_merge_readnext(), and load_tuple_array().
Definition at line 752 of file nodeGatherMerge.c.
References a, ApplySortComparator(), arg, Assert, b, compare(), DatumGetInt32(), GatherMergeState::gm_nkeys, GatherMergeState::gm_slots, GatherMergeState::gm_sortkeys, INVERT_COMPARE_RESULT, s1, s2, slot_getattr(), SortSupportData::ssup_attno, and TupIsNull.
Referenced by gather_merge_setup().
|
static |
Definition at line 597 of file nodeGatherMerge.c.
References GMReaderTupleBuffer::done, gm_readnext_tuple(), GatherMergeState::gm_tuple_buffers, i, MAX_TUPLE_STORE, GMReaderTupleBuffer::nTuples, GMReaderTupleBuffer::readCounter, and GMReaderTupleBuffer::tuple.
Referenced by gather_merge_init(), and gather_merge_readnext().