pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix assorted oversights in range selectivity estimation.
Date: Fri, 30 Jan 2015 17:31:17 +0000
Message-ID: <E1YHFPZ-0000va-4R@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3d660d33aab2f1eb98367a84eb2addf3e0969c05

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (3+ messages)

Message-ID: <E1YHFPZ-0000va-4R@gemulon.postgresql.org>
Permalink:  ../E1YHFPZ-0000va-4R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YHFPZ-0000va-4R@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix assorted oversights in range selectivity estimation.
  In-Reply-To: <E1YHFPZ-0000va-4R@gemulon.postgresql.org>
  References: <E1YHFPZ-0000va-4R@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox