pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: HashAgg: use better cardinality estimate for recursive spilling.
2+ messages / 1 participants
[nested] [flat]

* pgsql: HashAgg: use better cardinality estimate for recursive spilling.
@ 2020-07-29 06:17 Jeff Davis <jdavis@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Davis @ 2020-07-29 06:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: HashAgg: use better cardinality estimate for recursive spilling.
@ 2020-07-29 06:21 Jeff Davis <jdavis@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Davis @ 2020-07-29 06:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3a232a3183d517743acf232794fadc07f0944220

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-07-29 06:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 06:17 pgsql: HashAgg: use better cardinality estimate for recursive spilling. Jeff Davis <jdavis@postgresql.org>
2020-07-29 06:21 pgsql: HashAgg: use better cardinality estimate for recursive spilling. Jeff Davis <jdavis@postgresql.org>

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