From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: lucas@lucas-nussbaum.net
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14608: no index scan with NOT IN and ENUM
Date: Fri, 31 Mar 2017 15:49:26 -0400
Message-ID: <15734.1490989766@sss.pgh.pa.us> (raw)
In-Reply-To: <874ly95ky8.fsf@news-spur.riddles.org.uk>
References: <20170331185301.2690.64421@wrigleys.postgresql.org>
<874ly95ky8.fsf@news-spur.riddles.org.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "lucas" == lucas <lucas@lucas-nussbaum.net> writes:
> lucas> I would expect postgresql to figure out that "not in ('1', '2',
> lucas> '3', '4')" is equivalent to "d = '0'" given that the column is
> lucas> NOT NULL. And use the index.
> Well, whatever you expect, nobody has ever written code for the planner
> to make it figure that out (and it doesn't seem likely to be a major
> win, so probably not surprising that nobody did it).
TBH, even if someone submitted a patch that did that, it would probably
get rejected on the grounds that it consumed too many cycles in cases
where it failed to yield a win --- which would be most of the time.
Another problem is that ALTER TYPE ADD VALUE would have to invalidate
plans depending on such a deduction. The infrastructure needed to cope
with that would add still more distributed overhead, which would be paid
by everybody whether or not they ever issued a query that could benefit.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrew@tao11.riddles.org.uk, lucas@lucas-nussbaum.net
Subject: Re: BUG #14608: no index scan with NOT IN and ENUM
In-Reply-To: <15734.1490989766@sss.pgh.pa.us>
References: <20170331185301.2690.64421@wrigleys.postgresql.org> <874ly95ky8.fsf@news-spur.riddles.org.uk> <15734.1490989766@sss.pgh.pa.us>
* 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