Re: Are stored procedures pre-compiled? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Are stored procedures pre-compiled?
Date
Msg-id 13439.1014347744@sss.pgh.pa.us
Whole thread Raw
In response to Are stored procedures pre-compiled?  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> Are stored sql or pl/pgsql (and in fact other langs) precompiled on Postgres
> for efficiency???

plpgsql is, see 
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/plpgsql.html#PLPGSQL-OVERVIEW
although "compiling" might be a bit of a strong word for producing
query plans in advance.  One should certainly not mistake plpgsql
for a compiled-language substitute.  It's great for issuing queries
but not for adding 2 and 2 to get 4.

plperl and pltcl do whatever the underlying implementations of those
languages do.  Dunno about plpython.

I believe that SQL-language functions don't have any such optimization
at all :-( ... I think they are re-parsed and re-planned from scratch
on each call.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: SET NULL / SET NOT NULL
Next
From: Doug McNaught
Date:
Subject: Re: Are stored procedures pre-compiled?