From: Raymond Auge <RX_Auge@nickel.laurentian.ca>
To: pgsql-admin@postgresql.org
To: postgres@productivitymedia.com
Subject: Re: SQL Functions
Date: Tue, 19 Oct 2004 11:38:38 -0400
Message-ID: <s174fcdc.066@luadmn2.laurentian.ca> (raw)
Hello Postgres User,
I'd have to say that functions have the same "function" in SQL as they do in any language; a logical grouping of often repeated opperations.
So, if you have a repeated sequence like
query1(args);
if(result of query1 does this){
query2(args);
}
else{
query3(args);
}
then consider that you have 3 transactions with the database.
But, if all that was put into a SQL function, you have 1 transaction; "functions in SQL are atomic".
As well, in you code you have
sql_function(args);
and that's it...
clean and very fast.
--------------------------------------------------------------
Raymond Augé, B.COSC
Spécialiste en médiatisation de la formation/Multimedia specialist
Université Laurentienne / Laurentian University
<rx_auge@laurentienne.ca> / <rx_auge@laurentian.ca>
(705) 675-1151 x3934
>>> Postgres User <postgres@productivitymedia.com> 19/10/2004 11:12:47 am >>>
What are the advantages to SQL Functions? I'm looking to optimize
'default' PostgreSQL environments for clients. I'm writing an
application and looking to put functions to optimize just that table,
etc. They don't want to have a full-time database admin (surprise!).
Thanks,
J
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: RX_Auge@nickel.laurentian.ca, postgres@productivitymedia.com
Subject: Re: SQL Functions
In-Reply-To: <s174fcdc.066@luadmn2.laurentian.ca>
References: <s174fcdc.066@luadmn2.laurentian.ca>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox