Re: BUG #18440: Query does not prune partitions correctly or use index when prepared statements are used

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: damir(dot)ciganovic(dot)jankovic(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18440: Query does not prune partitions correctly or use index when prepared statements are used
Date: 2024-04-16 19:20:50
Message-ID: CAKFQuwbARATm+9Pmri+4nva2vYPP6hOQDcH48YHUgL9urKokQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Apr 16, 2024 at 11:56 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18440
> Logged by: Damir Ciganović-Janković
> Email address: damir(dot)ciganovic(dot)jankovic(at)gmail(dot)com
> PostgreSQL version: 15.6
> Operating system: Linux
> Description:
>
> Note, same bug from
>
> https://www.postgresql.org/message-id/17484-716a1fcbcb0e379b%40postgresql.org
> , I was instructed to check on Postgres 14, but the issue is still present
> in 15.6 and 16.2 versions.

Like with the other report this isn't a bug report. It is a symptom of
difficulty in explaining how all these complex features interact with each
other and thus users having the wrong expectations.

Compare the plans for a circa v13 execution and a circa v14 execution to
see what was gained.

https://dbfiddle.uk/tcwTciT9

In short, expecting even a custom plan of a prepared statement to match an
unprepared statement is incorrect. There is still considerable saved
worked done without knowledge of parameters that has to be ignored, not
discarded.

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2024-04-16 19:34:02 Re: relfrozenxid may disagree with row XIDs after 1ccc1e05ae
Previous Message Andres Freund 2024-04-16 18:01:08 Re: relfrozenxid may disagree with row XIDs after 1ccc1e05ae