Re: When are SQL functions inlined & how can I tell?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "J(dot) Greg Davidson" <jgd(at)well(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: When are SQL functions inlined & how can I tell?
Date: 2012-01-07 18:37:09
Message-ID: 4463.1325961429@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"J. Greg Davidson" <jgd(at)well(dot)com> writes:
> (1) What are the current criteria for when an SQL function called
> within another SQL function will be inlined?

It depends on a number of things, not least which PG version you're
talking about. When in doubt, consult the source code (see
inline_function or inline_set_returning_function in
src/backend/optimizer/util/clauses.c)

> (2) Is there some easy way to tell without massive logging whether
> a particular function has been inlined? I've tried doing various

> EXPLAIN ... SELECT foo(...);

> kinds of things where foo() calls bar() and I don't see that I can
> tell anything about the inline status of either function.

Try EXPLAIN VERBOSE. You should see either the function or its
expansion.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Christensen 2012-01-08 07:05:21 Is there a reason why Postgres doesn't have Byte or tinyint?
Previous Message J. Greg Davidson 2012-01-07 18:03:49 When are SQL functions inlined & how can I tell?