Skip site navigation (1) Skip section navigation (2)

pgsql: Collect and use histograms of lower and upper bounds for ranget

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Collect and use histograms of lower and upper bounds for ranget
Date: 2012-08-27 12:59:39
Message-ID: E1T5yup-0003CE-T7@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: 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

Next:From: Bruce MomjianDate: 2012-08-27 13:31:58
Subject: pgsql: Have pgindent requre pg_bsd_indent version 1.2 now that a newve
Previous:From: Peter EisentrautDate: 2012-08-27 04:53:50
Subject: pgsql: pg_basebackup: Correct error message

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group