Re: Compiling Functions in Postgresql

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Jasbinder Singh Bali <jsbali(at)gmail(dot)com>
Cc: Novice Postgresql-list <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Compiling Functions in Postgresql
Date: 2007-10-16 17:14:49
Message-ID: 1192554889.10677.176.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 2007-10-16 at 02:17 -0400, Jasbinder Singh Bali wrote:
> Hi,
>
> I know that in Sql Server, Stored Procedures are compiled only once
> and then the same execution plan is utilized. This definitely gives a
> tremendous performance boost
> when Stored Procedures are called repeatedly.
>
> Now, in Postgresql, how are the User Defined Functions compiled. Is it
> just once or every single time a function is called.
> I used Function instead of Stored Procedure while talking about
> Postgresql because Stored Procedures in Postgresql are Wrapped around
> in
> a User Defined Function.

Functions are evaluated the first time that they are called in a
session. At that point the plan for any database operations is done and
it is left available for future executions within the same session.

A session is from user connection to disconnection.

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
Do you want to know God? http://www.lfix.co.uk/knowing_god.html

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Hans-Peter Oeri 2007-10-16 21:05:12 Implementation of a updateable, "temporal" view on data
Previous Message Jasbinder Singh Bali 2007-10-16 06:17:59 Compiling Functions in Postgresql