|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/parallel.h"#include "executor/executor.h"#include "executor/hashjoin.h"#include "executor/nodeHash.h"#include "executor/nodeHashjoin.h"#include "miscadmin.h"#include "utils/lsyscache.h"#include "utils/sharedtuplestore.h"#include "utils/wait_event.h"
Go to the source code of this file.
Macros | |
| #define | HJ_BUILD_HASHTABLE 1 |
| #define | HJ_NEED_NEW_OUTER 2 |
| #define | HJ_SCAN_BUCKET 3 |
| #define | HJ_FILL_OUTER_TUPLE 4 |
| #define | HJ_FILL_INNER_TUPLES 5 |
| #define | HJ_NEED_NEW_BATCH 6 |
| #define | HJ_FILL_OUTER(hjstate) ((hjstate)->hj_NullInnerTupleSlot != NULL) |
| #define | HJ_FILL_INNER(hjstate) ((hjstate)->hj_NullOuterTupleSlot != NULL) |
| #define HJ_BUILD_HASHTABLE 1 |
Definition at line 180 of file nodeHashjoin.c.
Definition at line 190 of file nodeHashjoin.c.
| #define HJ_FILL_INNER_TUPLES 5 |
Definition at line 184 of file nodeHashjoin.c.
Definition at line 188 of file nodeHashjoin.c.
| #define HJ_FILL_OUTER_TUPLE 4 |
Definition at line 183 of file nodeHashjoin.c.
| #define HJ_NEED_NEW_BATCH 6 |
Definition at line 185 of file nodeHashjoin.c.
| #define HJ_NEED_NEW_OUTER 2 |
Definition at line 181 of file nodeHashjoin.c.
| #define HJ_SCAN_BUCKET 3 |
Definition at line 182 of file nodeHashjoin.c.
| void ExecEndHashJoin | ( | HashJoinState * | node | ) |
Definition at line 948 of file nodeHashjoin.c.
References ExecEndNode(), ExecHashTableDestroy(), fb(), HashJoinState::hj_HashTable, innerPlanState, and outerPlanState.
Referenced by ExecEndNode().
|
static |
Definition at line 684 of file nodeHashjoin.c.
References ExecHashJoinImpl().
Referenced by ExecInitHashJoin().
| void ExecHashJoinEstimate | ( | HashJoinState * | state, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 1648 of file nodeHashjoin.c.
References ParallelContext::estimator, shm_toc_estimate_chunk, and shm_toc_estimate_keys.
Referenced by ExecParallelEstimate().
|
static |
Definition at line 1455 of file nodeHashjoin.c.
References BufFileReadExact(), BufFileReadMaybeEOF(), CHECK_FOR_INTERRUPTS, ExecClearTuple(), ExecForceStoreMinimalTuple(), fb(), palloc(), and MinimalTupleData::t_len.
Referenced by ExecHashJoinNewBatch(), and ExecHashJoinOuterGetTuple().
|
static |
Definition at line 221 of file nodeHashjoin.c.
References Assert, BarrierArriveAndWait(), BarrierPhase(), ParallelHashJoinState::build_barrier, castNode, CHECK_FOR_INTERRUPTS, HashJoinTableData::curbatch, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, elog, ERROR, ExecFetchSlotMinimalTuple(), ExecHashGetBucketAndBatch(), ExecHashGetSkewBucket(), ExecHashJoinNewBatch(), ExecHashJoinOuterGetTuple(), ExecHashJoinSaveTuple(), ExecHashTableCreate(), ExecParallelHashJoinNewBatch(), ExecParallelHashJoinOuterGetTuple(), ExecParallelHashJoinPartitionOuter(), ExecParallelPrepHashTableForUnmatched(), ExecParallelScanHashBucket(), ExecParallelScanHashTableForUnmatched(), ExecPrepHashTableForUnmatched(), ExecProcNode(), ExecProject(), ExecQual(), ExecScanHashBucket(), ExecScanHashTableForUnmatched(), fb(), heap_free_minimal_tuple(), HeapTupleHeaderHasMatch(), HeapTupleHeaderSetMatch(), HJ_BUILD_HASHTABLE, HashJoinState::hj_CurBucketNo, HashJoinState::hj_CurHashValue, HashJoinState::hj_CurSkewBucketNo, HashJoinState::hj_CurTuple, HJ_FILL_INNER, HJ_FILL_INNER_TUPLES, HJ_FILL_OUTER, HJ_FILL_OUTER_TUPLE, HashJoinState::hj_FirstOuterTupleSlot, HashJoinState::hj_HashTable, HashJoinState::hj_JoinState, HashJoinState::hj_MatchedOuter, HJ_NEED_NEW_BATCH, HJ_NEED_NEW_OUTER, HashJoinState::hj_NullInnerTupleSlot, HashJoinState::hj_NullOuterTupleSlot, HashJoinState::hj_OuterNotEmpty, HJ_SCAN_BUCKET, HJTUPLE_MINTUPLE, innerPlanState, InstrCountFiltered1, InstrCountFiltered2, INVALID_SKEW_BUCKET_NO, JOIN_ANTI, JOIN_RIGHT_ANTI, JOIN_RIGHT_SEMI, JoinState::joinqual, JoinState::jointype, HashJoinState::js, MultiExecProcNode(), HashJoinTableData::nbatch, HashJoinTableData::nbatch_outstart, HashJoinTableData::outerBatchFile, outerPlanState, PHJ_BUILD_FREE, PHJ_BUILD_HASH_OUTER, PHJ_BUILD_RUN, JoinState::ps, PlanState::ps_ExprContext, PlanState::ps_ProjInfo, PlanState::qual, ResetExprContext, JoinState::single_match, HashJoinTableData::totalTuples, and TupIsNull.
Referenced by ExecHashJoin(), and ExecParallelHashJoin().
| void ExecHashJoinInitializeDSM | ( | HashJoinState * | state, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 1655 of file nodeHashjoin.c.
References BarrierInit(), ParallelHashJoinState::batches, ParallelHashJoinState::build_barrier, ParallelHashJoinState::chunk_work_queue, ParallelHashJoinState::distributor, ExecParallelHashJoin(), ExecSetExecProcNode(), fb(), ParallelHashJoinState::fileset, ParallelHashJoinState::grow_batches_barrier, ParallelHashJoinState::grow_buckets_barrier, ParallelHashJoinState::growth, innerPlanState, InvalidDsaPointer, ParallelHashJoinState::lock, LWLockInitialize(), ParallelHashJoinState::nbatch, ParallelHashJoinState::nbuckets, ParallelHashJoinState::nparticipants, ParallelContext::nworkers, ParallelHashJoinState::old_batches, pg_atomic_init_u32(), PHJ_GROWTH_OK, ParallelContext::seg, SharedFileSetInit(), shm_toc_allocate(), shm_toc_insert(), ParallelHashJoinState::space_allowed, ParallelContext::toc, and ParallelHashJoinState::total_tuples.
Referenced by ExecParallelInitializeDSM().
| void ExecHashJoinInitializeWorker | ( | HashJoinState * | state, |
| ParallelWorkerContext * | pwcxt | ||
| ) |
Definition at line 1751 of file nodeHashjoin.c.
References ExecParallelHashJoin(), ExecSetExecProcNode(), fb(), ParallelHashJoinState::fileset, innerPlanState, SharedFileSetAttach(), and shm_toc_lookup().
Referenced by ExecParallelInitializeWorker().
|
static |
Definition at line 1130 of file nodeHashjoin.c.
References BufFileClose(), BufFileSeek(), HashJoinTableData::curbatch, ereport, errcode_for_file_access(), errmsg(), ERROR, ExecHashJoinGetSavedTuple(), ExecHashTableInsert(), ExecHashTableReset(), fb(), HJ_FILL_INNER, HJ_FILL_OUTER, HashJoinTableData::innerBatchFile, HashJoinTableData::nbatch, HashJoinTableData::nbatch_original, HashJoinTableData::nbatch_outstart, HashJoinTableData::nSkewBuckets, HashJoinTableData::outerBatchFile, HashJoinTableData::skewBucket, HashJoinTableData::skewBucketNums, HashJoinTableData::skewEnabled, and HashJoinTableData::spaceUsedSkew.
Referenced by ExecHashJoinImpl().
|
static |
Definition at line 979 of file nodeHashjoin.c.
References HashJoinTableData::curbatch, DatumGetUInt32(), ExprContext::ecxt_outertuple, ExecEvalExprSwitchContext(), ExecHashJoinGetSavedTuple(), ExecProcNode(), fb(), HashJoinTableData::outerBatchFile, ResetExprContext, and TupIsNull.
Referenced by ExecHashJoinImpl().
| void ExecHashJoinReInitializeDSM | ( | HashJoinState * | state, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 1713 of file nodeHashjoin.c.
References BarrierInit(), ParallelHashJoinState::build_barrier, ExecHashTableDetach(), ExecHashTableDetachBatch(), fb(), ParallelHashJoinState::fileset, ParallelContext::seg, SharedFileSetDeleteAll(), shm_toc_lookup(), and ParallelContext::toc.
Referenced by ExecParallelReInitializeDSM().
| void ExecHashJoinSaveTuple | ( | MinimalTuple | tuple, |
| uint32 | hashvalue, | ||
| BufFile ** | fileptr, | ||
| HashJoinTable | hashtable | ||
| ) |
Definition at line 1414 of file nodeHashjoin.c.
References BufFileCreateTemp(), BufFileWrite(), fb(), MemoryContextSwitchTo(), HashJoinTableData::spillCxt, and MinimalTupleData::t_len.
Referenced by ExecHashIncreaseNumBatches(), ExecHashJoinImpl(), ExecHashRemoveNextSkewBucket(), and ExecHashTableInsert().
| HashJoinState * ExecInitHashJoin | ( | HashJoin * | node, |
| EState * | estate, | ||
| int | eflags | ||
| ) |
Definition at line 716 of file nodeHashjoin.c.
References Assert, elog, ERROR, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecBuildHash32Expr(), ExecGetResultSlotOps(), ExecGetResultType(), ExecHashJoin(), ExecInitExtraTupleSlot(), ExecInitNode(), ExecInitNullTupleSlot(), ExecInitQual(), ExecInitResultTupleSlotTL(), fb(), fmgr_info(), foreach_current_index, get_op_hash_functions(), hash(), HashJoin::hashclauses, HashJoin::hashcollations, HashJoin::hashkeys, HashJoin::hashoperators, HJ_BUILD_HASHTABLE, HJ_FILL_INNER, HJ_FILL_OUTER, i, Join::inner_unique, innerPlan, innerPlanState, INVALID_SKEW_BUCKET_NO, HashJoin::join, JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_RIGHT_ANTI, JOIN_RIGHT_SEMI, JOIN_SEMI, Join::joinqual, Join::jointype, lfirst_oid, linitial_oid, list_length(), makeNode, OidIsValid, op_strict(), outerPlan, outerPlanState, palloc0_object, palloc_array, pfree(), Hash::plan, and TTSOpsVirtual.
Referenced by ExecInitNode().
|
static |
Definition at line 700 of file nodeHashjoin.c.
References ExecHashJoinImpl().
Referenced by ExecHashJoinInitializeDSM(), and ExecHashJoinInitializeWorker().
|
static |
Definition at line 1271 of file nodeHashjoin.c.
References BarrierArriveAndWait(), BarrierAttach(), BarrierDetach(), BarrierPhase(), ParallelHashJoinBatch::batch_barrier, HashJoinTableData::batches, HashJoinTableData::curbatch, ParallelHashJoinState::distributor, ParallelHashJoinBatchAccessor::done, elog, ERROR, ExecForceStoreMinimalTuple(), ExecHashTableDetachBatch(), ExecParallelHashTableAlloc(), ExecParallelHashTableInsertCurrentBatch(), ExecParallelHashTableSetCurrentBatch(), fb(), ParallelHashJoinBatchAccessor::inner_tuples, HashJoinTableData::nbatch, ParallelHashJoinBatchAccessor::outer_tuples, HashJoinTableData::parallel_state, pg_atomic_fetch_add_u32(), PHJ_BATCH_ALLOCATE, PHJ_BATCH_ELECT, PHJ_BATCH_FREE, PHJ_BATCH_LOAD, PHJ_BATCH_PROBE, PHJ_BATCH_SCAN, ParallelHashJoinBatchAccessor::shared, sts_begin_parallel_scan(), sts_end_parallel_scan(), and sts_parallel_scan_next().
Referenced by ExecHashJoinImpl().
|
static |
Definition at line 1058 of file nodeHashjoin.c.
References HashJoinTableData::batches, HashJoinTableData::curbatch, DatumGetUInt32(), ExprContext::ecxt_outertuple, ExecClearTuple(), ExecEvalExprSwitchContext(), ExecForceStoreMinimalTuple(), ExecProcNode(), fb(), HashJoinTableData::nbatch, ParallelHashJoinBatchAccessor::outer_eof, ParallelHashJoinBatchAccessor::outer_tuples, ResetExprContext, sts_parallel_scan_next(), and TupIsNull.
Referenced by ExecHashJoinImpl().
|
static |
Definition at line 1597 of file nodeHashjoin.c.
References Assert, HashJoinTableData::batches, CHECK_FOR_INTERRUPTS, DatumGetUInt32(), ExprContext::ecxt_outertuple, ExecEvalExprSwitchContext(), ExecFetchSlotMinimalTuple(), ExecHashGetBucketAndBatch(), ExecProcNode(), fb(), heap_free_minimal_tuple(), i, HashJoinTableData::nbatch, ParallelHashJoinBatchAccessor::outer_tuples, outerPlanState, ResetExprContext, sts_end_write(), sts_puttuple(), and TupIsNull.
Referenced by ExecHashJoinImpl().
| void ExecReScanHashJoin | ( | HashJoinState * | node | ) |
Definition at line 1494 of file nodeHashjoin.c.
References Assert, castNode, ExecHashAccumInstrumentation(), ExecHashTableDestroy(), ExecHashTableResetMatchFlags(), ExecReScan(), fb(), HJ_BUILD_HASHTABLE, HashJoinState::hj_CurBucketNo, HashJoinState::hj_CurHashValue, HashJoinState::hj_CurSkewBucketNo, HashJoinState::hj_CurTuple, HJ_FILL_INNER, HashJoinState::hj_FirstOuterTupleSlot, HashJoinState::hj_HashTable, HashJoinState::hj_JoinState, HashJoinState::hj_MatchedOuter, HJ_NEED_NEW_OUTER, HashJoinState::hj_OuterNotEmpty, innerPlan, innerPlanState, INVALID_SKEW_BUCKET_NO, JOIN_RIGHT_SEMI, JoinState::jointype, HashJoinState::js, HashJoinTableData::nbatch, outerPlan, outerPlanState, and palloc0_object.
Referenced by ExecReScan().
| void ExecShutdownHashJoin | ( | HashJoinState * | node | ) |
Definition at line 1582 of file nodeHashjoin.c.
References ExecHashTableDetach(), ExecHashTableDetachBatch(), and HashJoinState::hj_HashTable.
Referenced by ExecShutdownNode_walker().