pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: surprising query optimisation
Date: Wed, 5 Dec 2018 09:33:40 -0500
Message-ID: <20181205143340.GB3415@tamriel.snowman.net> (raw)
In-Reply-To: <4b68075c-55b0-e937-f794-125251573011@gmx.net>
References: <03a0af57-3ebc-5501-10ef-6a639c7c34b8@withers.org>
	<20181128224950.GS3415@tamriel.snowman.net>
	<5d7f8d97-32f3-fd88-44cc-948673579a71@withers.org>
	<CAOuzzgpXKJ440Um1-1uEv_HCXU+BFxD7gN8vQBpH1kKXgB8wiA@mail.gmail.com>
	<076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org>
	<CAOuzzgpAYrTTvDi_gzwj=EXaCNLLZ4CnxJe-MHTH0Zp-ZZxYcw@mail.gmail.com>
	<4b68075c-55b0-e937-f794-125251573011@gmx.net>

Greetings,

* Thomas Kellerer (spam_eater@gmx.net) wrote:
> Stephen Frost schrieb am 30.11.2018 um 14:05:
> > PG doesn’t know, with complete certainty, that there’s only 3
> > values.
>  
> Would the optimizer consult a check constraint ensuring that?

Not today, I don't believe (haven't looked at the code though, to be
fair), and seems like it'd be an awful lot of work for a rare
use-case that would be better with just a partial index..

What we will do today is if you ask for a specific value and there's a
CHECK constraint which lists out specific values and that value isn't
among the set, then we'll just skip over the table (One-time filter:
false), thanks to constraint exclusion.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (19+ messages)  latest in thread

Message-ID: <20181205143340.GB3415@tamriel.snowman.net>
Permalink:  ../20181205143340.GB3415@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20181205143340.GB3415@tamriel.snowman.net

 · 

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-general@postgresql.org
  Cc: sfrost@snowman.net, spam_eater@gmx.net
  Subject: Re: surprising query optimisation
  In-Reply-To: <20181205143340.GB3415@tamriel.snowman.net>
  References: <03a0af57-3ebc-5501-10ef-6a639c7c34b8@withers.org> <20181128224950.GS3415@tamriel.snowman.net> <5d7f8d97-32f3-fd88-44cc-948673579a71@withers.org> <CAOuzzgpXKJ440Um1-1uEv_HCXU+BFxD7gN8vQBpH1kKXgB8wiA@mail.gmail.com> <076fec6e-3bb4-3a99-e71f-dc1cec684cb6@withers.org> <CAOuzzgpAYrTTvDi_gzwj=EXaCNLLZ4CnxJe-MHTH0Zp-ZZxYcw@mail.gmail.com> <4b68075c-55b0-e937-f794-125251573011@gmx.net> <20181205143340.GB3415@tamriel.snowman.net>

* 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