agora inbox for pgsql-performance@postgresql.org  
help / color / mirror / Atom feed
From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Cc: pgsql-performance@lists.postgresql.org <pgsql-performance@lists.postgresql.org>
Cc: Christophe Courtois <christophe.courtois@dalibo.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Subject: Re: Indexes on expressions with multiple columns and operators
Date: Fri, 19 Sep 2025 16:37:45 +0200
Message-ID: <20250919163745.1dfc1044@karst> (raw)
In-Reply-To: <1975239.1758214751@sss.pgh.pa.us>
References: <a8b99dce-1bfb-4d97-af73-54a32b85c916@dalibo.com>
	<1507576.1758120083@sss.pgh.pa.us>
	<20250918172628.44301672@karst>
	<1975239.1758214751@sss.pgh.pa.us>

On Thu, 18 Sep 2025 12:59:11 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Jehan-Guillaume de Rorthais <jgdr@dalibo.com> writes:
> > On a fresh instance from HEAD with its default configuration, it shows:
> 
> >   Index Scan using foo_s_idx on foo  (cost=0.29..8.39 rows=33333 width=13)
> >     Index Cond: (s(crit, ackid) = true)
> 
> > It seems statistics shown in "pg_stats" view for function "s()" are good.
> > The query itself even have the same costs than the query using the syntax
> > tips you provide before.
> 
> > However, the estimated row number seems wrong in regard with the costs shown
> > and statistics.
> 
> Yeah.  The problem is that clause_selectivity_ext fails to consider
> use of statistics if the clause looks like "bool_valued_function(...)".
> If it looks like "bool_valued_function(...) = true", that goes down
> a different code path that does the right thing.

Oh, OK, I understand.

Thanks for your explanations!

Regards,





view thread (26+ messages)  latest in thread

Message-ID: <20250919163745.1dfc1044@karst>
Permalink:  ../20250919163745.1dfc1044@karst/
Also on:    postgresql.org/message-id/20250919163745.1dfc1044@karst

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: jgdr@dalibo.com, tgl@sss.pgh.pa.us, frederic.yhuel@dalibo.com, pgsql-performance@lists.postgresql.org, christophe.courtois@dalibo.com, laurenz.albe@cybertec.at
  Subject: Re: Indexes on expressions with multiple columns and operators
  In-Reply-To: <20250919163745.1dfc1044@karst>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox