pgsql: Improve statistics estimation for single-column GROUP BY in sub-

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve statistics estimation for single-column GROUP BY in sub-
Date: 2025-02-19 09:59:48
Message-ID: E1tkgrt-0006xK-0o@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve statistics estimation for single-column GROUP BY in sub-queries

This commit follows the idea of the 4767bc8ff2. If sub-query has only one
GROUP BY column, we can consider its output variable as being unique. We can
employ this fact in the statistics to make more precise estimations in the
upper query block.

Author: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e983ee9380fcac746f9b6b7c360d255d9fcd0907

Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 53 +++++++++++++++++++--------------
src/include/utils/selfuncs.h | 3 +-
src/test/regress/expected/stats_ext.out | 15 ++++++++++
src/test/regress/sql/stats_ext.sql | 12 ++++++++
4 files changed, 60 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-02-19 12:09:53 pgsql: Add ATAlterConstraint struct for ALTER .. CONSTRAINT
Previous Message Amit Kapila 2025-02-19 09:49:43 pgsql: Add a test for commit ac0e33136a using the injection point.