Re: functions vs embedded SQL

From: Jeff Davis <list-pgsql-general(at)dynworks(dot)com>
To: "Culley Harrelson" <Culley_Harrelson(at)pgn(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: functions vs embedded SQL
Date: 2001-11-06 20:51:07
Message-ID: 200111062053.MAA21096@smtp.ucsd.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It seems you might be referring to PL/PgSQL (not SQL/pgsql).
All the "PL"s , or Procedural Languages, are server-side programming, JDBC
and php are client-side.

PLs are used when you need the database to do some processing before it sends
the response to the client. PLs are most helpful when used to reduce the
number of seperate transactions a client needs to execute to perform one
function, or reduce the amount of unnecessary data that is sent to the client
(data that the client only needs as an intermediate step toward retrieving
the required data, or inserting the required data).

Moreover, PLs can be aggregate functions, or functions that operate on all of
the records in the result set. This can be very helpful if, for example, you
are performing a statistical calculation on the values in a column. You would
only have to return the result to the client, the server can do the
calculating (which is much more efficient, especially in terms of
communication between the client and the sever).

You need client programming either way. Without a client, the server is
useless :)

Regards,
Jeff Davis

On Tuesday 06 November 2001 11:56 am, you wrote:
> Does anyone have an opinion on the performance benefits/drawbacks on using
> SQL/pgsql functions rather than embedding SQL directly in your code? I use
> JDBC and php for different projects...
>
> Culley

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric Ridge 2001-11-06 20:56:09 pg_dump and DEFAULT column values
Previous Message Guy Fraser 2001-11-06 20:50:38 Re: Sum(time) possible?