From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix assorted oversights in range selectivity estimation. |
Date: | 2015-01-30 17:31:17 |
Message-ID: | E1YHFPZ-0000vd-4d@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix assorted oversights in range selectivity estimation.
calc_rangesel() failed outright when comparing range variables to empty
constant ranges with < or >=, as a result of missing cases in a switch.
It also produced a bogus estimate for > comparison to an empty range.
On top of that, the >= and > cases were mislabeled throughout. For
nonempty constant ranges, they managed to produce the right answers
anyway as a result of counterbalancing typos.
Also, default_range_selectivity() omitted cases for elem <@ range,
range &< range, and range &> range, so that rather dubious defaults
were applied for these operators.
In passing, rearrange the code in rangesel() so that the elem <@ range
case is handled in a less opaque fashion.
Report and patch by Emre Hasegeli, some additional work by me
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/527ff8baf259263cc861b2058385d92829d1ba28
Modified Files
--------------
src/backend/utils/adt/rangetypes_selfuncs.c | 50 ++++++++++++++++++---------
src/include/catalog/pg_operator.h | 4 +--
src/test/regress/expected/rangetypes.out | 32 +++++++++++++++++
src/test/regress/sql/rangetypes.sql | 4 +++
4 files changed, 72 insertions(+), 18 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2015-01-30 17:58:34 | pgsql: Provide a way to supress the "out of memory" error when allocati |
Previous Message | Heikki Linnakangas | 2015-01-30 17:18:21 | pgsql: Fix query-duration memory leak with GIN rescans. |