Search Postgresql Archives

Re: Any risks in using FUNCTIONs (stored procedures) instead of raw sql queries?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joshua D. Drake wrote:
> On Wed, 2008-11-19 at 18:40 +0900, Craig Ringer wrote:
>> Phoenix Kiula wrote:
>>
>>> I have googled but it looks like there's a whole variety of
>>> information from 2003 (when PG must have been quite different) until
>>> now--some people find stored functions slow for web based apps, others
>>> find it is worth the maintenance.
>> If your web servers are very close in network terms to your database 
>> server, issue mostly non-trivial queries, and are on a low latency link, 
>> it probably doesn't matter *that* much.
> 
> For one query no... for a dynamic website that uses 100 - 200 queries to
> draw a page?
> 
> .... 
> 
> 15ms * 200, 3000ms = 3 secs * 2 (both ways) = 6 seconds.

Exactly - that's why I mentioned that it probably didn't matter if the
app issued mostly non-trivial queries. It's unlikely that a couple of
hundred queries will mostly be non-trivial; most will be simple SELECT
something FROM atable WHERE key = value; .

It depends on the app. Some apps don't _need_ a couple of hundred
queries to obtain the data for a page. If you're only issuing five or
ten queries, the latency isn't going to be significant.

--
Craig Ringer

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux