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

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

From
Alexander Korotkov
Date:
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@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.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(-)