Re: inlining SQL functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexey Klyukin <alexk(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: inlining SQL functions
Date: 2010-04-02 17:12:47
Message-ID: 28647.1270228367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alexey Klyukin <alexk(at)commandprompt(dot)com> writes:
> Is there a reason why only a table free SQL functions are allowed to
> be inlined ? I wonder why a simple SQL function containing only a
> SELECT * FROM table can't be expanded inline ?

If you're thinking of just replacing the call with a sub-SELECT
construct, that's no good in general because it would change the
semantics. We can and do inline such things when the function
returns SETOF and is in the FROM list, but a regular scalar subselect
acts a bit differently than scalar SQL functions historically have.

Keep in mind also that there's not going to be a lot of benefit from
inlining other cases, since a subselect that's not in FROM is not
very optimizable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-04-02 18:44:22 Re: Compile fail, alpha5 & gcc 4.3.3 in elog.c
Previous Message Peter Geoghegan 2010-04-02 17:10:15 Re: Alpha release this week?