From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
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-09-26 11:42:05 |
Message-ID: | CAMbWs4_AmLq9ssUh+fu8KZk8QPhx21=+o3whspLNAhxY6T0Xzw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Sep 24, 2022 at 8:41 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> On Sat, Sep 24, 2022 at 8:04 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Richard Guo <guofenglinux(at)gmail(dot)com> writes:
>> > We should have already done that long before. It seems afterwards we may
>> > do additional transformation on indexquals. In this case with a boolean
>> > index, I can see we convert the indexqual to form 'indexkey = TRUE' in
>> > match_boolean_index_clause.
>>
>> Of course, but what about that transformation would introduce something
>> that eval_const_expressions could simplify? (Actually, now that I think
>> about it, I think eval_const_expressions would break it completely because
>> it'd re-canonicalize the expression as just 'indexkey', exactly what we
>> don't want here.) In any case, if there's something between the
>> eval_const_expressions pass and createplan.c that introduces simplifiable
>> expressions, I think it's on that something's head to re-simplify; we
>> don't want to do something so expensive in a main code path if it's
>> usually going to be a complete waste.
>
>
> Yeah, I agree that running eval_const_expressions here is expensive.
> Maybe we can just do the reverse transformation in
> create_bitmap_scan_plan against what we do for boolean index in
> match_boolean_index_clause?
>
Following this idea, I come up with v2 patch. Is this the right
direction to go?
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v2-0001-constant-folding-for-indexquals-in-bitmap-scan.patch | application/octet-stream | 4.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Masahiko Sawada | 2022-09-27 01:26:11 | Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end |
Previous Message | Tom Lane | 2022-09-26 10:59:47 | Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end |