From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
Cc: | lucas(at)lucas-nussbaum(dot)net, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14608: no index scan with NOT IN and ENUM |
Date: | 2017-03-31 19:49:26 |
Message-ID: | 15734.1490989766@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> "lucas" == lucas <lucas(at)lucas-nussbaum(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | paul.coyne | 2017-03-31 21:10:11 | BUG #14609: ON CONSTRAINT (aka UPSERT) code fails when excluded.<columname> used in calculation. |
Previous Message | Andrew Gierth | 2017-03-31 19:04:04 | Re: BUG #14608: no index scan with NOT IN and ENUM |