Re: SQL functions not being inlined

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Evan Martin <postgresql(at)realityexists(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL functions not being inlined
Date: 2012-05-03 15:30:47
Message-ID: 24367.1336059047@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Evan Martin <postgresql(at)realityexists(dot)net> writes:
> Thanks, I went into that function, added log statements everywhere and
> figured which check it's failing on:
> !heap_attisnull(func_tuple, Anum_pg_proc_proconfig)
> and it's because my real function had this at the end:

> SET search_path FROM CURRENT;

Well, shame on you for omitting that critical detail from your example.

> which I never imagined would make any difference.

The reason SET options disable inlining is that inlining would leave
noplace for the SET to be applied and then removed. In some cases it's
possible that we could prove that the SET need not occur at runtime,
but the inlining mechanism doesn't have that much knowledge about
configuration parameters.

> This still doesn't
> explain why it was being inlined sometimes - I didn't add and remove
> that bit, it was there the whole time!

That does seem improbable. You sure you were looking at just one
function?

> Is there any reason this stuff isn't documented? It can have huge
> performance implications, so I'm surprised more people don't run into
> it.

There are a huge number of details of planner behavior that "can have
huge performance implications", and they change frequently. It's not
clear to me that we can document this stuff in a way that's better than
referring to the source code.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message yxj 2012-05-03 15:31:35 Re: Limit the normal user to see system catalog or not??? And create privilege???
Previous Message yxj 2012-05-03 15:23:50 Re: Re: How to insert random character data into tables for testing purpose. THanks.