pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: HashAgg: use better cardinality estimate for recursive spilling.
Date: Wed, 29 Jul 2020 06:17:13 +0000
Message-ID: <E1k0fOr-0007rm-Iz@gemulon.postgresql.org> (raw)

HashAgg: use better cardinality estimate for recursive spilling.

Use HyperLogLog to estimate the group cardinality in a spilled
partition. This estimate is used to choose the number of partitions if
we recurse.

The previous behavior was to use the number of tuples in a spilled
partition as the estimate for the number of groups, which lead to
overpartitioning. That could cause the number of batches to be much
higher than expected (with each batch being very small), which made it
harder to interpret EXPLAIN ANALYZE results.

Reviewed-by: Peter Geoghegan
Discussion: https://postgr.es/m/a856635f9284bc36f7a77d02f47bbb6aaf7b59b3.camel@j-davis.com
Backpatch-through: 13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9878b643f37b1e4167f64a9941244bfabed60623

Modified Files
--------------
src/backend/executor/nodeAgg.c | 64 +++++++++++++++++++++++++++---------------
src/include/executor/nodeAgg.h |  2 +-
2 files changed, 43 insertions(+), 23 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1k0fOr-0007rm-Iz@gemulon.postgresql.org>
Permalink:  ../E1k0fOr-0007rm-Iz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1k0fOr-0007rm-Iz@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: HashAgg: use better cardinality estimate for recursive spilling.
  In-Reply-To: <E1k0fOr-0007rm-Iz@gemulon.postgresql.org>
  References: <E1k0fOr-0007rm-Iz@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox