|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/parallel.h"#include "catalog/objectaccess.h"#include "catalog/pg_aggregate.h"#include "catalog/pg_proc.h"#include "catalog/pg_type.h"#include "common/hashfn.h"#include "executor/execExpr.h"#include "executor/executor.h"#include "executor/instrument.h"#include "executor/nodeAgg.h"#include "lib/hyperloglog.h"#include "miscadmin.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "parser/parse_agg.h"#include "parser/parse_coerce.h"#include "port/pg_bitutils.h"#include "utils/acl.h"#include "utils/builtins.h"#include "utils/datum.h"#include "utils/expandeddatum.h"#include "utils/injection_point.h"#include "utils/logtape.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/memutils_memorychunk.h"#include "utils/syscache.h"#include "utils/tuplesort.h"
Go to the source code of this file.
Data Structures | |
| struct | HashAggSpill |
| struct | HashAggBatch |
| struct | FindColsContext |
Typedefs | |
| typedef struct HashAggSpill | HashAggSpill |
| typedef struct HashAggBatch | HashAggBatch |
| typedef struct FindColsContext | FindColsContext |
| #define CHUNKHDRSZ sizeof(MemoryChunk) |
| typedef struct HashAggBatch HashAggBatch |
| typedef struct HashAggSpill HashAggSpill |
Definition at line 819 of file nodeAgg.c.
References ExecEvalExprNoReturnSwitchContext(), and fb().
Referenced by agg_fill_hash_table(), agg_refill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 709 of file nodeAgg.c.
References FunctionCallInfoBaseData::args, datumCopy(), DatumGetPointer(), ExecAggCopyTransValue(), fb(), FmgrInfo::fn_strict, FunctionCallInvoke, i, FunctionCallInfoBaseData::isnull, NullableDatum::isnull, MemoryContextSwitchTo(), AggStatePerTransData::numTransInputs, AggStatePerTransData::transfn, AggStatePerTransData::transfn_fcinfo, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, and NullableDatum::value.
Referenced by process_ordered_aggregate_multi(), and process_ordered_aggregate_single().
Definition at line 2629 of file nodeAgg.c.
References advance_aggregates(), ExprContext::ecxt_outertuple, fb(), fetch_input_tuple(), hashagg_finish_initial_spills(), lookup_hash_entries(), ResetExprContext, ResetTupleHashIterator, select_current_set(), and TupIsNull.
Referenced by ExecAgg().
Definition at line 2683 of file nodeAgg.c.
References advance_aggregates(), AGG_MIXED, Assert, CHECK_FOR_INTERRUPTS, ExecStoreMinimalTuple(), fb(), hash(), hash_agg_set_limits(), hash_agg_update_metrics(), hashagg_batch_read(), hashagg_recompile_expressions(), hashagg_spill_finish(), hashagg_spill_init(), hashagg_spill_tuple(), AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, initialize_hash_entry(), INJECTION_POINT, list_delete_last(), llast, LogicalTapeClose(), LookupTupleHashEntryHash(), MemSet, NIL, pfree(), prepare_hash_slot(), ReScanExprContext(), ResetExprContext, ResetTupleHashIterator, ResetTupleHashTable(), select_current_set(), and TupleHashEntryGetAdditional().
Referenced by agg_retrieve_hash_table().
|
static |
Definition at line 2283 of file nodeAgg.c.
References advance_aggregates(), AGG_MIXED, AGG_PLAIN, agg_retrieve_hash_table(), Agg::aggstrategy, Assert, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, ExecCopySlotHeapTuple(), ExecForceStoreHeapTuple(), ExecQual(), ExecQualAndReset(), fb(), fetch_input_tuple(), finalize_aggregates(), hashagg_finish_initial_spills(), i, initialize_aggregates(), initialize_phase(), lookup_hash_entries(), Max, Agg::numCols, prepare_projection_slot(), project_aggregates(), ReScanExprContext(), ResetExprContext, ResetTupleHashIterator, select_current_set(), and TupIsNull.
Referenced by ExecAgg().
|
static |
Definition at line 2837 of file nodeAgg.c.
References agg_refill_hash_table(), agg_retrieve_hash_table_in_memory(), and fb().
Referenced by agg_retrieve_direct(), and ExecAgg().
|
static |
Definition at line 2862 of file nodeAgg.c.
References CHECK_FOR_INTERRUPTS, ExprContext::ecxt_outertuple, ExecClearTuple(), ExecStoreMinimalTuple(), ExecStoreVirtualTuple(), fb(), finalize_aggregates(), AggStatePerHashData::hashGrpColIdxInput, AggStatePerHashData::hashiter, AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, i, AggStatePerHashData::numhashGrpCols, prepare_projection_slot(), project_aggregates(), ResetExprContext, ResetTupleHashIterator, ScanTupleHashTable, select_current_set(), slot_getallattrs(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, TupleHashEntryGetAdditional(), and TupleHashEntryGetTuple().
Referenced by agg_retrieve_hash_table().
| int AggCheckCallContext | ( | FunctionCallInfo | fcinfo, |
| MemoryContext * | aggcontext | ||
| ) |
Definition at line 4609 of file nodeAgg.c.
References AGG_CONTEXT_AGGREGATE, AGG_CONTEXT_WINDOW, FunctionCallInfoBaseData::context, ExprContext::ecxt_per_tuple_memory, fb(), and IsA.
Referenced by array_agg_array_combine(), array_agg_array_deserialize(), array_agg_array_finalfn(), array_agg_array_serialize(), array_agg_array_transfn(), array_agg_combine(), array_agg_deserialize(), array_agg_finalfn(), array_agg_serialize(), array_agg_transfn(), bytea_string_agg_finalfn(), bytea_string_agg_transfn(), fetch_array_arg_replace_nulls(), float4_accum(), float8_accum(), float8_combine(), float8_regr_accum(), float8_regr_combine(), hypothetical_dense_rank_final(), hypothetical_rank_common(), int2_avg_accum(), int2_avg_accum_inv(), int4_avg_accum(), int4_avg_accum_inv(), int4_avg_combine(), int8_avg_combine(), int8_avg_deserialize(), int8_avg_serialize(), interval_avg_deserialize(), interval_avg_serialize(), json_agg_finalfn(), json_agg_transfn_worker(), json_object_agg_finalfn(), json_object_agg_transfn_worker(), jsonb_agg_finalfn(), jsonb_agg_transfn_worker(), jsonb_object_agg_finalfn(), jsonb_object_agg_transfn_worker(), makeBoolAggState(), makeInt128AggState(), makeIntervalAggState(), makeNumericAggState(), makeStringAggState(), mode_final(), multirange_agg_transfn(), multirange_intersect_agg_transfn(), numeric_avg_combine(), numeric_avg_deserialize(), numeric_avg_serialize(), numeric_combine(), numeric_deserialize(), numeric_poly_combine(), numeric_poly_deserialize(), numeric_poly_serialize(), numeric_serialize(), ordered_set_startup(), percentile_cont_final_common(), percentile_cont_multi_final_common(), percentile_disc_final(), percentile_disc_multi_final(), range_agg_finalfn(), range_agg_transfn(), range_intersect_agg_transfn(), string_agg_combine(), string_agg_deserialize(), string_agg_finalfn(), and string_agg_serialize().
| Aggref * AggGetAggref | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4653 of file nodeAgg.c.
References AggStatePerTransData::aggref, AggStatePerAggData::aggref, FunctionCallInfoBaseData::context, fb(), and IsA.
Referenced by ordered_set_startup().
| MemoryContext AggGetTempMemoryContext | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4687 of file nodeAgg.c.
References FunctionCallInfoBaseData::context, fb(), and IsA.
| void AggRegisterCallback | ( | FunctionCallInfo | fcinfo, |
| ExprContextCallbackFunction | func, | ||
| Datum | arg | ||
| ) |
Definition at line 4752 of file nodeAgg.c.
References arg, FunctionCallInfoBaseData::context, elog, ERROR, fb(), IsA, and RegisterExprContextCallback().
Referenced by ordered_set_startup().
| bool AggStateIsShared | ( | FunctionCallInfo | fcinfo | ) |
Definition at line 4713 of file nodeAgg.c.
References AggStatePerTransData::aggshared, FunctionCallInfoBaseData::context, fb(), IsA, and AggStatePerAggData::transno.
Referenced by ordered_set_startup().
Definition at line 1508 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerHashData::aggnode, Assert, BuildTupleHashTable(), DO_AGGSPLIT_SKIPFINAL, AggStatePerHashData::eqfuncoids, fb(), AggStatePerHashData::hashfunctions, AggStatePerHashData::hashGrpColIdxHash, AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, AggStatePerHashData::numCols, TupleTableSlot::tts_ops, and TupleTableSlot::tts_tupleDescriptor.
Referenced by build_hash_tables().
Definition at line 1467 of file nodeAgg.c.
References AggStatePerHashData::aggnode, build_hash_table(), fb(), hash_choose_num_buckets(), AggStatePerHashData::hashtable, INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, Agg::numGroups, ResetTupleHashTable(), and TupleHashEntrySize().
Referenced by ExecInitAgg(), and ExecReScanAgg().
|
static |
Definition at line 4131 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerTransData::aggCollation, Aggref::aggdirectargs, Aggref::aggdistinct, Aggref::aggfilter, Aggref::aggorder, AggStatePerTransData::aggref, AggStatePerTransData::aggshared, AggStatePerTransData::aggsortrequired, AggStatePerTransData::aggtranstype, Aggref::args, Assert, build_aggregate_deserialfn_expr(), build_aggregate_serialfn_expr(), build_aggregate_transfn_expr(), AggStatePerTransData::deserialfn, AggStatePerTransData::deserialfn_fcinfo, AggStatePerTransData::deserialfn_oid, DO_AGGSPLIT_COMBINE, AggStatePerTransData::equalfnMulti, AggStatePerTransData::equalfnOne, ExecInitExtraTupleSlot(), execTuplesMatchPrepare(), ExecTypeFromTL(), exprCollation(), fb(), fmgr_info(), fmgr_info_set_expr, get_opcode(), get_sortgroupclause_tle(), get_typlenbyval(), i, InitFunctionCallInfoData, AggStatePerTransData::initValue, initValue(), AggStatePerTransData::initValueIsNull, AggStatePerTransData::inputtypeByVal, AggStatePerTransData::inputtypeLen, InvalidOid, lfirst, list_length(), Max, NIL, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numInputs, AggStatePerTransData::numSortCols, AggStatePerTransData::numTransInputs, OidIsValid, palloc(), palloc0_array, pfree(), AggStatePerTransData::serialfn, AggStatePerTransData::serialfn_fcinfo, AggStatePerTransData::serialfn_oid, SizeForFunctionCallInfo, AggStatePerTransData::sortColIdx, AggStatePerTransData::sortCollations, AggStatePerTransData::sortdesc, AggStatePerTransData::sortNullsFirst, AggStatePerTransData::sortOperators, AggStatePerTransData::sortslot, AggStatePerTransData::sortstates, AggStatePerTransData::transfn, AggStatePerTransData::transfn_fcinfo, AggStatePerTransData::transfn_oid, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, TTSOpsMinimalTuple, and AggStatePerTransData::uniqslot.
Referenced by ExecInitAgg().
|
static |
Definition at line 2247 of file nodeAgg.c.
References AggState::agg_done, agg_fill_hash_table(), AGG_HASHED, AGG_MIXED, AGG_PLAIN, agg_retrieve_direct(), agg_retrieve_hash_table(), AGG_SORTED, AggStatePerPhaseData::aggstrategy, castNode, CHECK_FOR_INTERRUPTS, fb(), pg_fallthrough, AggState::phase, AggState::table_filled, and TupIsNull.
Referenced by ExecInitAgg().
| void ExecAggEstimate | ( | AggState * | node, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 4781 of file nodeAgg.c.
References add_size(), ParallelContext::estimator, fb(), PlanState::instrument, mul_size(), ParallelContext::nworkers, ScanState::ps, shm_toc_estimate_chunk, shm_toc_estimate_keys, and AggState::ss.
Referenced by ExecParallelEstimate().
| void ExecAggInitializeDSM | ( | AggState * | node, |
| ParallelContext * | pcxt | ||
| ) |
Definition at line 4802 of file nodeAgg.c.
References fb(), PlanState::instrument, SharedAggInfo::num_workers, ParallelContext::nworkers, PlanState::plan, Plan::plan_node_id, ScanState::ps, AggState::shared_info, shm_toc_allocate(), shm_toc_insert(), AggState::ss, and ParallelContext::toc.
Referenced by ExecParallelInitializeDSM().
| void ExecAggInitializeWorker | ( | AggState * | node, |
| ParallelWorkerContext * | pwcxt | ||
| ) |
Definition at line 4827 of file nodeAgg.c.
References fb(), PlanState::plan, Plan::plan_node_id, ScanState::ps, AggState::shared_info, shm_toc_lookup(), and AggState::ss.
Referenced by ExecParallelInitializeWorker().
Definition at line 4840 of file nodeAgg.c.
References fb(), SharedAggInfo::num_workers, palloc(), and AggState::shared_info.
Referenced by ExecParallelRetrieveInstrumentation().
Definition at line 4396 of file nodeAgg.c.
References AggState::aggcontexts, Assert, ExecEndNode(), fb(), AggregateInstrumentation::hash_batches_used, AggState::hash_batches_used, AggState::hash_disk_used, AggState::hash_mem_peak, AggState::hash_metacxt, AggState::hash_tuplescxt, hashagg_reset_spill_state(), AggState::hashcontext, IsParallelWorker, Max, AggState::maxsets, MemoryContextDelete(), AggState::numtrans, outerPlan, outerPlanState, ParallelWorkerNumber, AggState::pertrans, ReScanExprContext(), AggState::shared_info, SharedAggInfo::sinstrument, AggState::sort_in, AggState::sort_out, AggStatePerTransData::sortstates, and tuplesort_end().
Referenced by ExecEndNode().
Definition at line 3281 of file nodeAgg.c.
References ACL_EXECUTE, aclcheck_error(), ACLCHECK_OK, AGG_HASHED, AGG_MIXED, AGG_PLAIN, AGG_SORTED, AggStatePerAggData::aggdirectargs, Aggref::aggdirectargs, Aggref::aggfnoid, AggStatePerPhaseData::aggnode, AggStatePerHashData::aggnode, AggStatePerTransData::aggref, AggStatePerAggData::aggref, AggStatePerTransData::aggshared, Agg::aggsplit, AggStatePerPhaseData::aggstrategy, Agg::aggstrategy, Aggref::args, Assert, bms_add_member(), bms_add_members(), bms_next_member(), build_aggregate_finalfn_expr(), build_hash_tables(), build_pertrans_for_aggref(), castNode, Agg::chain, DO_AGGSPLIT_COMBINE, DO_AGGSPLIT_DESERIALIZE, DO_AGGSPLIT_SERIALIZE, DO_AGGSPLIT_SKIPFINAL, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, elog, ereport, errcode(), errmsg, ERROR, AggStatePerPhaseData::evaltrans, AggStatePerPhaseData::evaltrans_cache, EXEC_FLAG_BACKWARD, EXEC_FLAG_EXPLAIN_ONLY, EXEC_FLAG_MARK, ExecAgg(), ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecBuildAggTrans(), ExecCreateScanSlotFromOuterPlan(), ExecGetResultSlotOps(), ExecInitExprList(), ExecInitExtraTupleSlot(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlotTL(), execTuplesMatchPrepare(), fb(), AggStatePerAggData::finalfn, AggStatePerAggData::finalfn_oid, find_hash_columns(), fmgr_info(), fmgr_info_set_expr, FmgrInfo::fn_strict, Form_pg_aggregate, Form_pg_proc, format_type_be(), FUNC_MAX_ARGS, get_aggregate_argtypes(), get_func_name(), get_typlenbyval(), GetAggInitVal(), GETSTRUCT(), GetUserId(), Agg::groupingSets, hash_agg_entry_size(), hash_agg_set_limits(), hash_create_memory(), HeapTupleIsValid, i, initialize_phase(), initValue(), AggStatePerTransData::initValueIsNull, InvalidOid, InvokeFunctionExecuteHook, IsBinaryCoercible(), j, lcons_int(), lfirst, list_length(), list_nth_node, makeNode, Max, NIL, AggStatePerHashData::numCols, Agg::numCols, AggStatePerAggData::numFinalArgs, AggStatePerPhaseData::numsets, AggStatePerTransData::numTransInputs, object_aclcheck(), OBJECT_AGGREGATE, OBJECT_FUNCTION, ObjectIdGetDatum(), OidIsValid, outerPlan, outerPlanState, palloc(), palloc0_array, palloc_array, Agg::plan, Plan::qual, ReleaseSysCache(), AggStatePerAggData::resulttypeByVal, AggStatePerAggData::resulttypeLen, SearchSysCache1(), select_current_set(), SysCacheGetAttr(), AggStatePerTransData::transfn, Agg::transitionSpace, AggStatePerAggData::transno, TTSOpsMinimalTuple, and TTSOpsVirtual.
Referenced by ExecInitNode().
Definition at line 4462 of file nodeAgg.c.
References AggState::agg_done, AGG_HASHED, AGG_MIXED, AggState::aggcontexts, Agg::aggParams, AggState::aggstrategy, bms_overlap(), build_hash_tables(), PlanState::chgParam, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExecClearTuple(), ExecReScan(), fb(), AggState::grp_firstTuple, AggState::hash_ever_spilled, AggState::hash_ngroups_current, AggState::hash_spill_mode, hashagg_recompile_expressions(), hashagg_reset_spill_state(), AggState::hashcontext, AggStatePerHashData::hashiter, AggStatePerHashData::hashtable, heap_freetuple(), initialize_phase(), AggState::input_done, Max, AggState::maxsets, MemSet, AggState::numaggs, AggState::numtrans, outerPlan, outerPlanState, AggState::pergroups, AggState::perhash, AggState::pertrans, PlanState::plan, AggState::projected_set, ScanState::ps, PlanState::ps_ExprContext, ReScanExprContext(), ResetTupleHashIterator, select_current_set(), AggStatePerTransData::sortstates, AggState::ss, ScanState::ss_ScanTupleSlot, AggState::table_filled, and tuplesort_end().
Referenced by ExecReScan().
|
static |
Definition at line 550 of file nodeAgg.c.
References CHECK_FOR_INTERRUPTS, ExecProcNode(), fb(), outerPlanState, TupIsNull, tuplesort_gettupleslot(), and tuplesort_puttupleslot().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 1046 of file nodeAgg.c.
References AggStatePerTransData::aggCollation, AggStatePerAggData::aggdirectargs, ExecEvalExpr(), fb(), AggStatePerAggData::finalfn, AggStatePerAggData::finalfn_oid, FUNC_MAX_ARGS, FunctionCallInvoke, i, InitFunctionCallInfoData, lfirst, LOCAL_FCINFO, MakeExpandedObjectReadOnly, MemoryContextSwitchTo(), AggStatePerAggData::numFinalArgs, OidIsValid, AggStatePerAggData::resulttypeLen, AggStatePerAggData::transno, and AggStatePerTransData::transtypeLen.
Referenced by finalize_aggregates().
|
static |
Definition at line 1294 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, AggStatePerTransData::aggsortrequired, Assert, DatumGetPointer(), DO_AGGSPLIT_SKIPFINAL, ExprContext::ecxt_aggnulls, ExprContext::ecxt_aggvalues, ExecClearTuple(), fb(), finalize_aggregate(), finalize_partialaggregate(), AggStatePerTransData::haslast, AggStatePerTransData::inputtypeByVal, AggStatePerTransData::lastdatum, AggStatePerTransData::lastisnull, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numInputs, pfree(), process_ordered_aggregate_multi(), process_ordered_aggregate_single(), AggStatePerAggData::transno, and AggStatePerTransData::uniqslot.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
|
static |
Definition at line 1146 of file nodeAgg.c.
References FunctionCallInfoBaseData::args, fb(), FmgrInfo::fn_strict, FunctionCallInvoke, FunctionCallInfoBaseData::isnull, NullableDatum::isnull, MakeExpandedObjectReadOnly, MemoryContextSwitchTo(), OidIsValid, AggStatePerAggData::resulttypeLen, AggStatePerTransData::serialfn, AggStatePerTransData::serialfn_fcinfo, AggStatePerTransData::serialfn_oid, AggStatePerAggData::transno, AggStatePerTransData::transtypeLen, and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 1397 of file nodeAgg.c.
References FindColsContext::aggregated, bms_add_member(), fb(), find_cols_walker(), i, FindColsContext::is_aggref, Agg::plan, and FindColsContext::unaggregated.
Referenced by find_hash_columns().
|
static |
Definition at line 1420 of file nodeAgg.c.
References FindColsContext::aggregated, Assert, bms_add_member(), expression_tree_walker, fb(), find_cols_walker(), FindColsContext::is_aggref, IsA, OUTER_VAR, FindColsContext::unaggregated, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by find_cols(), and find_cols_walker().
Definition at line 1569 of file nodeAgg.c.
References AggStatePerHashData::aggnode, attnum, bms_add_member(), bms_copy(), bms_del_member(), bms_free(), bms_is_member(), bms_next_member(), bms_num_members(), bms_union(), AggStatePerHashData::eqfuncoids, EState::es_tupleTable, ExecAllocTableSlot(), execTuplesHashPrepare(), ExecTypeFromTL(), fb(), find_cols(), AggStatePerHashData::hashfunctions, AggStatePerHashData::hashGrpColIdxHash, AggStatePerHashData::hashGrpColIdxInput, AggStatePerHashData::hashslot, i, j, lappend(), AggStatePerHashData::largestGrpColIdx, lfirst_int, list_free(), list_nth(), Max, NIL, AggStatePerHashData::numCols, AggStatePerHashData::numhashGrpCols, outerPlanState, palloc(), and TTSOpsMinimalTuple.
Referenced by ExecInitAgg().
Definition at line 4380 of file nodeAgg.c.
References fb(), getTypeInputInfo(), OidInputFunctionCall(), pfree(), and TextDatumGetCString.
Referenced by ExecInitAgg().
Definition at line 1866 of file nodeAgg.c.
References fb(), hash_agg_enter_spill_mode(), INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, and MemoryContextMemAllocated().
Referenced by initialize_hash_entry().
Definition at line 1910 of file nodeAgg.c.
References AggStatePerHashData::aggnode, Assert, fb(), hashagg_recompile_expressions(), hashagg_spill_init(), INJECTION_POINT, LogicalTapeSetCreate(), Agg::numGroups, and palloc_array.
Referenced by hash_agg_check_limits().
Definition at line 1700 of file nodeAgg.c.
References CHUNKHDRSZ, fb(), MAXALIGN, pg_nextpower2_size_t, SizeofMinimalTupleHeader, and TupleHashEntrySize().
Referenced by cost_agg(), estimate_hashagg_tablesize(), and ExecInitAgg().
| void hash_agg_set_limits | ( | double | hashentrysize, |
| double | input_groups, | ||
| int | used_bits, | ||
| Size * | mem_limit, | ||
| uint64 * | ngroups_limit, | ||
| int * | num_partitions | ||
| ) |
Definition at line 1808 of file nodeAgg.c.
References fb(), get_hash_memory_limit(), hash_choose_num_partitions(), HASHAGG_READ_BUFFER_SIZE, and HASHAGG_WRITE_BUFFER_SIZE.
Referenced by agg_refill_hash_table(), cost_agg(), and ExecInitAgg().
Definition at line 1946 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, fb(), HASHAGG_READ_BUFFER_SIZE, HASHAGG_WRITE_BUFFER_SIZE, LogicalTapeSetBlocks(), MemoryContextMemAllocated(), and TupleHashEntrySize().
Referenced by agg_refill_hash_table(), and hashagg_finish_initial_spills().
Definition at line 2057 of file nodeAgg.c.
References fb().
Referenced by build_hash_tables().
|
static |
Definition at line 2086 of file nodeAgg.c.
References fb(), get_hash_memory_limit(), HASHAGG_MAX_PARTITIONS, HASHAGG_MIN_PARTITIONS, HASHAGG_PARTITION_FACTOR, HASHAGG_READ_BUFFER_SIZE, HASHAGG_WRITE_BUFFER_SIZE, and pg_ceil_log2_32().
Referenced by hash_agg_set_limits(), and hashagg_spill_init().
Definition at line 1999 of file nodeAgg.c.
References ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, BumpContextCreate(), CreateWorkExprContext(), fb(), Max, Min, pg_prevpower2_size_t, and work_mem.
Referenced by ExecInitAgg().
|
static |
Definition at line 3099 of file nodeAgg.c.
References fb(), and palloc0_object.
Referenced by hashagg_spill_finish().
|
static |
Definition at line 3118 of file nodeAgg.c.
References ereport, errcode_for_file_access(), errmsg_internal(), ERROR, fb(), hash(), LogicalTapeRead(), palloc(), and MinimalTupleData::t_len.
Referenced by agg_refill_hash_table().
Definition at line 3167 of file nodeAgg.c.
References fb(), hash_agg_update_metrics(), hashagg_spill_finish(), HashAggSpill::npartitions, and pfree().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
static |
Definition at line 1751 of file nodeAgg.c.
References AGG_HASHED, AGG_MIXED, Assert, AggStatePerPhaseData::evaltrans, AggStatePerPhaseData::evaltrans_cache, ExecBuildAggTrans(), fb(), i, j, and TTSOpsMinimalTuple.
Referenced by agg_refill_hash_table(), ExecReScanAgg(), and hash_agg_enter_spill_mode().
Definition at line 3241 of file nodeAgg.c.
References fb(), list_free_deep(), LogicalTapeSetClose(), NIL, and pfree().
Referenced by ExecEndAgg(), and ExecReScanAgg().
|
static |
Definition at line 3201 of file nodeAgg.c.
References estimateHyperLogLog(), fb(), freeHyperLogLog(), hashagg_batch_new(), HASHAGG_READ_BUFFER_SIZE, i, lappend(), LogicalTapeRewindForRead(), and pfree().
Referenced by agg_refill_hash_table(), and hashagg_finish_initial_spills().
|
static |
Definition at line 2986 of file nodeAgg.c.
References fb(), hash_choose_num_partitions(), HASHAGG_HLL_BIT_WIDTH, i, initHyperLogLog(), INJECTION_POINT_CACHED, IS_INJECTION_POINT_ATTACHED, LogicalTapeCreate(), and palloc0_array.
Referenced by agg_refill_hash_table(), hash_agg_enter_spill_mode(), and lookup_hash_entries().
|
static |
Definition at line 3029 of file nodeAgg.c.
References addHyperLogLog(), Assert, bms_is_member(), ExecClearTuple(), ExecFetchSlotMinimalTuple(), ExecStoreVirtualTuple(), fb(), hash(), hash_bytes_uint32(), i, LogicalTapeWrite(), pfree(), slot_getsomeattrs(), MinimalTupleData::t_len, TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
|
static |
Definition at line 581 of file nodeAgg.c.
References AggStatePerTransData::aggsortrequired, datumCopy(), fb(), AggStatePerTransData::initValue, AggStatePerTransData::initValueIsNull, MemoryContextSwitchTo(), AggStatePerTransData::numInputs, AggStatePerTransData::numSortCols, AggStatePerTransData::sortColIdx, AggStatePerTransData::sortCollations, AggStatePerTransData::sortdesc, AggStatePerTransData::sortNullsFirst, AggStatePerTransData::sortOperators, AggStatePerTransData::sortstates, AggStatePerTransData::transtypeByVal, AggStatePerTransData::transtypeLen, TupleDescAttr(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_end(), TUPLESORT_NONE, and work_mem.
Referenced by initialize_aggregates(), and initialize_hash_entry().
|
static |
Definition at line 668 of file nodeAgg.c.
References fb(), initialize_aggregate(), Max, and select_current_set().
Referenced by agg_retrieve_direct().
|
static |
Definition at line 2140 of file nodeAgg.c.
References fb(), hash_agg_check_limits(), initialize_aggregate(), and TupleHashEntryGetAdditional().
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
Definition at line 480 of file nodeAgg.c.
References Assert, ExecGetResultType(), fb(), Sort::numCols, outerPlanState, tuplesort_begin_heap(), tuplesort_end(), TUPLESORT_NONE, tuplesort_performsort(), and work_mem.
Referenced by agg_retrieve_direct(), ExecInitAgg(), and ExecReScanAgg().
Definition at line 2184 of file nodeAgg.c.
References AggStatePerHashData::aggnode, fb(), hash(), hashagg_spill_init(), hashagg_spill_tuple(), AggStatePerHashData::hashslot, AggStatePerHashData::hashtable, initialize_hash_entry(), LookupTupleHashEntry(), Agg::numGroups, prepare_hash_slot(), select_current_set(), and TupleHashEntryGetAdditional().
Referenced by agg_fill_hash_table(), and agg_retrieve_direct().
|
inlinestatic |
Definition at line 1204 of file nodeAgg.c.
References ExecClearTuple(), ExecStoreVirtualTuple(), fb(), AggStatePerHashData::hashGrpColIdxInput, i, AggStatePerHashData::largestGrpColIdx, AggStatePerHashData::numhashGrpCols, slot_getsomeattrs(), TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by agg_refill_hash_table(), and lookup_hash_entries().
|
static |
Definition at line 1249 of file nodeAgg.c.
References attnum, bms_is_member(), ExecStoreAllNullTuple(), fb(), lfirst_int, linitial_int, slot_getsomeattrs(), TTS_EMPTY, and TupleTableSlot::tts_isnull.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
|
static |
Definition at line 949 of file nodeAgg.c.
References advance_transition_function(), FunctionCallInfoBaseData::args, CHECK_FOR_INTERRUPTS, ExprContext::ecxt_innertuple, ExprContext::ecxt_outertuple, AggStatePerTransData::equalfnMulti, ExecClearTuple(), ExecQual(), fb(), i, NullableDatum::isnull, AggStatePerTransData::numDistinctCols, AggStatePerTransData::numTransInputs, ResetExprContext, slot_getsomeattrs(), AggStatePerTransData::sortslot, AggStatePerTransData::sortstates, AggStatePerTransData::transfn_fcinfo, tuplesort_end(), tuplesort_gettupleslot(), tuplesort_performsort(), AggStatePerTransData::uniqslot, and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 848 of file nodeAgg.c.
References advance_transition_function(), AggStatePerTransData::aggCollation, FunctionCallInfoBaseData::args, Assert, datumCopy(), DatumGetBool(), DatumGetPointer(), AggStatePerTransData::equalfnOne, fb(), FunctionCall2Coll(), AggStatePerTransData::inputtypeByVal, AggStatePerTransData::inputtypeLen, NullableDatum::isnull, MemoryContextReset(), MemoryContextSwitchTo(), AggStatePerTransData::numDistinctCols, pfree(), AggStatePerTransData::sortstates, AggStatePerTransData::transfn_fcinfo, tuplesort_end(), tuplesort_getdatum(), tuplesort_performsort(), and NullableDatum::value.
Referenced by finalize_aggregates().
|
static |
Definition at line 1371 of file nodeAgg.c.
References ExecProject(), ExecQual(), fb(), and InstrCountFiltered1.
Referenced by agg_retrieve_direct(), and agg_retrieve_hash_table_in_memory().
Definition at line 458 of file nodeAgg.c.
References fb().
Referenced by agg_fill_hash_table(), agg_refill_hash_table(), agg_retrieve_direct(), agg_retrieve_hash_table_in_memory(), ExecInitAgg(), ExecReScanAgg(), initialize_aggregates(), and lookup_hash_entries().