pgsql: Collect and use histograms of lower and upper bounds for range t - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Collect and use histograms of lower and upper bounds for range t
Date
Msg-id E1T5yup-0003CE-T7@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Collect and use histograms of lower and upper bounds for range types.

This enables selectivity estimation of the <<, >>, &<, &> and && operators,
as well as the normal inequality operators: <, <=, >=, >. "range @> element"
is also supported, but the range-variant @> and <@ operators are not,
because they cannot be sensibly estimated with lower and upper bound
histograms alone. We would need to make some assumption about the lengths of
the ranges for that. Alexander's patch included a separate histogram of
lengths for that, but I left that out of the patch for simplicity. Hopefully
that will be added as a followup patch.

The fraction of empty ranges is also calculated and used in estimation.

Alexander Korotkov, heavily modified by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/918eee0c497c88260a2e107318843c9b1947bc6f

Modified Files
--------------
src/backend/utils/adt/Makefile                |    3 +-
src/backend/utils/adt/rangetypes.c            |   17 -
src/backend/utils/adt/rangetypes_selfuncs.c   |  599 +++++++++++++++++++++++++
src/backend/utils/adt/rangetypes_typanalyze.c |  232 ++++++++++
src/include/catalog/catversion.h              |    2 +-
src/include/catalog/pg_operator.h             |   39 ++-
src/include/catalog/pg_proc.h                 |    2 +
src/include/catalog/pg_statistic.h            |   18 +
src/include/utils/rangetypes.h                |    1 +
9 files changed, 881 insertions(+), 32 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: pg_basebackup: Correct error message
Next
From: Bruce Momjian
Date:
Subject: pgsql: Have pgindent requre pg_bsd_indent version 1.2 now that a new ve