Re: Stored procedures returning rowsets

From: Gregory Seidman <gss+pg(at)cs(dot)brown(dot)edu>
To: "Pgsql-General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Stored procedures returning rowsets
Date: 2002-08-13 14:30:48
Message-ID: 20020813143048.GA24524@cs.brown.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jaroslaw Nozderko sez:
} Hi Mark,
}
} >
} > Previously
} >
} > >Perhaps not all these factors are always important, but in big and
} > >heavy loaded systems it's really unimaginable to send "raw" queries.
} >
} > Interesting,
} >
} > I have heard this often... mainly from SQL Server folk....
} > I find it hard to understand what is bad about "raw" sql....
} > here is why :
} >
} > As I understand it, every query goes through the stages of
} > parse,execute, [and possibly fetch(es)].
}
} I think there is also plan/optimize stage between parse and execute...
} And it may be expensive. Another advantage of stored procedures
} is possibility of encapsulating business logic on server side only.

Excapsulating business logic on the DB server seems to be the best reason
I've heard. In fact, I am in the process of writing a large web application
and, more and more, I find that I want to write server-side plpgsql
functions to encapsulate transactions, simplifying the programmatic
interaction with the database to SELECT Func(args, ...) for the most part,
particularly for updates.

It is not, however, clear to me the difference between a stored procedure
which can be CALL'd and a function which must be SELECT'd. Can anyone
explain why the distinction is important?

} Regards,
} Jarek
--Greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tommi Maekitalo 2002-08-13 14:32:11 Re: [HACKERS] Linux Largefile Support In Postgresql RPMS
Previous Message Tom Lane 2002-08-13 14:23:40 Re: [GENERAL] Linux Largefile Support In Postgresql RPMS