From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: surprising query optimisation |
Date: | 2018-12-05 14:33:40 |
Message-ID: | 20181205143340.GB3415@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greetings,
* Thomas Kellerer (spam_eater(at)gmx(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Withers | 2018-12-05 14:34:18 | debugging intermittent slow updates under higher load |
Previous Message | Dejan Petrovic | 2018-12-05 14:10:13 | Database corruption in cascaded replica, "pg_xact/003A" doesn't exist, reading as zeroes" |