aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAgg.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2025-01-02 22:04:09 +1300
committerDavid Rowley <drowley@postgresql.org>2025-01-02 22:04:09 +1300
commitd93bb8163c9cdbaa922ce6b1f3d044fc589d0fa6 (patch)
treef5f928256048f76dbef281deb2fe06bbe4300a91 /src/backend/executor/nodeAgg.c
parent11012c503759f8018d8831bc6eb1f998eba7ad25 (diff)
downloadpostgresql-d93bb8163c9cdbaa922ce6b1f3d044fc589d0fa6.tar.gz
postgresql-d93bb8163c9cdbaa922ce6b1f3d044fc589d0fa6.zip
Fix outdated CHUNKHDRSZ value in nodeAgg.c
CHUNKHDRSZ was defined as 16 bytes, which was true when that code went in, but since c6e0fe1f2, 8 is a more accurate value. Here we adjust it to use sizeof(MemoryChunk), which is normally 8, or 16 for cassert builds. c6e0fe1f2 first appeared in v16, so this is technically wrong in v16 up to master, but let's apply this only to master as adjusting this does influence the estimated number of batches in the aggregate costing code and we don't want to cause plan instability in released versions. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAApHDvpMpRQvsTqZo3FinXkgytwxwF8sCyZm83xDj-1s_hLe+w@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r--src/backend/executor/nodeAgg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index b48a12c1a34..66cd4616963 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -272,6 +272,7 @@
#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"
@@ -314,10 +315,9 @@
#define HASHAGG_HLL_BIT_WIDTH 5
/*
- * Estimate chunk overhead as a constant 16 bytes. XXX: should this be
- * improved?
+ * Assume the palloc overhead always uses sizeof(MemoryChunk) bytes.
*/
-#define CHUNKHDRSZ 16
+#define CHUNKHDRSZ sizeof(MemoryChunk)
/*
* Represents partitioned spill data for a single hashtable. Contains the