Re: pg_stat_statements and "IN" conditions - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: pg_stat_statements and "IN" conditions
Date
Msg-id i3ts47ewsvg4adcx4mywebgvuz6ubvir56fmhuuvuy4fjb2gsa@d2vo3oz46zd3
Whole thread Raw
In response to Re: pg_stat_statements and "IN" conditions  (Sami Imseih <samimseih@gmail.com>)
List pgsql-hackers
> On Mon, Feb 17, 2025 at 09:51:32AM GMT, Sami Imseih wrote:
> > This should do it. The last patch for today,
>
> I looked at v27 today and have a few comments.
>
> 1/ It looks like the CTE test is missing a check for results.

This test was to catch a crash that was happening in older version of
the patch, so it doesn't have to verify the actual pgss entry.

> 2/ Looking at IsMergeableConst, I am not sure why we care about
> things like function volatility, implicit cast or funcid > FirstGenbkiObjectId?

Function volatility is important to establish how constant is the
result, for now we would like to exclude not immutable functions. The
implicit cast and builtin check are there to limit squashing and exclude
explicit or user-created functions (the second is probably an overkill,
but this could be gradually relatex later). Or are you not sure about
something different?

> 3/ Here, this looks wrong as we could end up traversing an elements list
> twice. Once inside IsMergeableConstList and if that call returns false, we end
> up traversing through the elements list again in _jumbleNode.

IsMergeableConstList and _jumbleNode serve different purposes, so it's
probably unwise to try to replace one with another. E.g.
IsMergeableConstList will stop at the first non-constant expression, so
it's not a full traversal.



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions
Next
From: Andres Freund
Date:
Subject: Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup