Re: Custom function ROWS hint ignored due to inlining?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Semanchuk <philip(at)americanefficient(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Custom function ROWS hint ignored due to inlining?
Date: 2022-10-19 23:09:56
Message-ID: 2944321.1666220996@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Philip Semanchuk <philip(at)americanefficient(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-10-19 23:59:52 Re: Postgres 15 upgrades and template1 public schema
Previous Message Bruno Wolff III 2022-10-19 22:48:28 Re: Postgres 15 upgrades and template1 public schema