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.
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 Momjian||Date: 2012-08-27 13:31:58|
|Subject: pgsql: Have pgindent requre pg_bsd_indent version 1.2 now that a newve|
|Previous:||From: Peter Eisentraut||Date: 2012-08-27 04:53:50|
|Subject: pgsql: pg_basebackup: Correct error message|