pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Philip Semanchuk <philip@americanefficient.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Custom function ROWS hint ignored due to inlining?
Date: Wed, 19 Oct 2022 19:09:56 -0400
Message-ID: <2944321.1666220996@sss.pgh.pa.us> (raw)
In-Reply-To: <76B16E5F-59D0-4C97-8DBA-4B3BB21E2009@americanefficient.com>
References: <76B16E5F-59D0-4C97-8DBA-4B3BB21E2009@americanefficient.com>

Philip Semanchuk <philip@americanefficient.com> writes:
> I have a custom function where the ROWS hint is getting ignored. I think it’s because the function is getting inlined, but I’d like a second opinion.

Yeah, I believe you're right about that.

> I would prefer to have the function inlined for better performance, but
> I can declare it VOLATILE if that’s necessary to give decent estimates
> to the planner. Am I correctly reading the situation? If so, is there
> another solution that allows inlining *and* making the ROWS hint visible
> to the planner?

No, but you could experiment with changing the function to plpgsql
instead of SQL.  Not sure about the relative performance of those
cases, but it's worth trying it both ways.

			regards, tom lane





view thread (2+ messages)

Message-ID: <2944321.1666220996@sss.pgh.pa.us>
Permalink:  ../2944321.1666220996@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2944321.1666220996@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, philip@americanefficient.com
  Subject: Re: Custom function ROWS hint ignored due to inlining?
  In-Reply-To: <2944321.1666220996@sss.pgh.pa.us>
  References: <76B16E5F-59D0-4C97-8DBA-4B3BB21E2009@americanefficient.com> <2944321.1666220996@sss.pgh.pa.us>

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

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