mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Refactor hash_agg_entry_size().
Consolidate the calculations for hash table size estimation. This will help with upcoming Hash Aggregation work that will add additional call sites.
This commit is contained in:
@ -4867,13 +4867,8 @@ create_distinct_paths(PlannerInfo *root,
|
||||
allow_hash = false; /* policy-based decision not to hash */
|
||||
else
|
||||
{
|
||||
Size hashentrysize;
|
||||
|
||||
/* Estimate per-hash-entry space at tuple width... */
|
||||
hashentrysize = MAXALIGN(cheapest_input_path->pathtarget->width) +
|
||||
MAXALIGN(SizeofMinimalTupleHeader);
|
||||
/* plus the per-hash-entry overhead */
|
||||
hashentrysize += hash_agg_entry_size(0);
|
||||
Size hashentrysize = hash_agg_entry_size(
|
||||
0, cheapest_input_path->pathtarget->width, 0);
|
||||
|
||||
/* Allow hashing only if hashtable is predicted to fit in work_mem */
|
||||
allow_hash = (hashentrysize * numDistinctRows <= work_mem * 1024L);
|
||||
|
Reference in New Issue
Block a user