Re: BUG #17618: unnecessary filter column <> text even after adding index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, sindysenorita(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17618: unnecessary filter column <> text even after adding index
Date: 2022-11-07 21:06:33
Message-ID: 3495354.1667855193@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> I've updated the patch according to the suggestions as in v4. Thanks
> for reviewing this patch!

I was about ready to commit this when I re-read your initial comment
and realized that there's a second way to fix it. We can improve
predtest.c so that it understands that "x = true" implies "x" and
so on, whereupon the existing logic in create_bitmap_scan_plan
handles the case correctly. This is pretty nearly the same code as
in your v4, except that it's in a considerably less hot code path, plus
there's at least some chance that it could be useful for other purposes.
So I think I like this way better. Thoughts?

regards, tom lane

Attachment Content-Type Size
v5-0001-constant-folding-for-indexquals-in-bitmap-scan.patch text/x-diff 4.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2022-11-08 01:59:34 Re: BUG #17618: unnecessary filter column <> text even after adding index
Previous Message Tom Lane 2022-11-07 16:41:35 Re: BUG #17679: REFRESH MATERIALIZED VIEW CONCURRENTLY leaves temporary files?