MCPcopy Create free account
hub / github.com/apache/cloudberry / get_hash_memory_limit

Function get_hash_memory_limit

src/backend/executor/nodeHash.c:4111–4123  ·  view source on GitHub ↗

* Calculate the limit on how much memory can be used by Hash and similar * plan types. This is work_mem times hash_mem_multiplier, and is * expressed in bytes. * * Exported for use by the planner, as well as other hash-like executor * nodes. This is a rather random place for this, but there is no better * place. * * GPDB_14_MERGE_FIXME: Postgres uses work_mem to control the memory usage

Source from the content-addressed store, hash-verified

4109 * and no other places actually need it to multiply with work_mem.
4110 */
4111size_t
4112get_hash_memory_limit(void)
4113{
4114 double mem_limit;
4115
4116 /* Do initial calculation in double arithmetic */
4117 mem_limit = (double) work_mem * hash_mem_multiplier * 1024.0;
4118
4119 /* Clamp in case it doesn't fit in size_t */
4120 mem_limit = Min(mem_limit, (double) SIZE_MAX);
4121
4122 return (size_t) mem_limit;
4123}
4124
4125/*
4126 * Convert the hash memory limit to an integer number of kilobytes,

Callers 12

BuildTupleHashTableExtFunction · 0.85
get_hash_memFunction · 0.85
ExecInitMemoizeFunction · 0.85
subplan_is_hashableFunction · 0.85
subpath_is_hashableFunction · 0.85
choose_hashed_setopFunction · 0.85
cost_memoize_rescanFunction · 0.85
final_cost_hashjoinFunction · 0.85
create_unique_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected