Re: SET or STRICT modifiers on function affect planner row estimates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michał Kłeczek <michal(at)kleczek(dot)org>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET or STRICT modifiers on function affect planner row estimates
Date: 2024-09-30 19:24:26
Message-ID: 1496155.1727724266@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?utf-8?Q?Micha=C5=82_K=C5=82eczek?= <michal(at)kleczek(dot)org> writes:
>> On 30 Sep 2024, at 14:14, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>> It is difficult to understand the exact problem from your description.
>> Can you please provide EXPLAIN outputs showing the expected plan and
>> the unexpected plan; plans on the node where the query is run and
>> where the partitions are located.

> The table structure is as follows:

> CREATE TABLE tbl (…) PARTITION BY RANGE year(col02_date)

You're still expecting people to magically intuit what all those
"..."s are. I could spend many minutes trying to reconstruct
a runnable example from these fragments, and if it didn't behave
as you say, it'd be wasted effort because I didn't guess right
about some un-mentioned detail. Please provide a *self-contained*
example if you want someone to poke into this in any detail.
You have not mentioned your PG version, either.

My first guess would be that adding STRICT or adding a SET clause
prevents function inlining, because it does. However, your Plan 2
doesn't seem to involve a FunctionScan node, so either these plans
aren't really what you say or there's something else going on.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2024-09-30 19:29:53 Re: AIO v2.0
Previous Message Daniel Verite 2024-09-30 19:15:44 Re: Fixing backslash dot for COPY FROM...CSV