Re: Why are stored procedures looked on so negatively?

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Neil Tiffin <neilt(at)neiltiffin(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, Some Developer <someukdeveloper(at)gmail(dot)com>
Subject: Re: Why are stored procedures looked on so negatively?
Date: 2013-08-01 20:38:57
Message-ID: 51FAC761.5060903@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 02/08/13 08:24, Kevin Grittner wrote:
[...]
> When working as a consultant, one client was doing everything
> client-side and engaged me to fix some performance problems. In one
> case a frequently run query was taking two minutes. As a stored
> procedure the correct results were returned in two seconds. This same
> client had a report which ran for 72 hours. A stored procedure was
> able to return the correct data in 2.5 minutes, although it took
> another 10 minutes for the client side to process it into the output
> format. Stored procedures are not a panacea, however. Writing in a
> declarative format is, in my experience, much more important. I saw
> one case where a SQL procedure written in imperative form, navigating
> through linkages a row at a time, was on pace to complete in over a
> year. Rewritten in declarative form it ran in a few minutes. As a
> side benefit, the declarative form is usually 10% to 20% the number of
> lines of code, and less buggy. For retrieval of complex data sets,
> the big thing is to learn to write SQL which specifies *what you want*
> rather then trying to specify *how to get it*. -- Kevin Grittner EDB:
> http://www.enterprisedb.com The Enterprise PostgreSQL Company

Trust the Planner, Luke!
(Apologies to Star Wars)

Very informative, learnt more in the above, and omitted text, than I
have for a long while - certainly clarified my ideas on the subject.

Cheers,
Gavin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message BladeOfLight16 2013-08-01 22:49:19 Add a NOT NULL column with default only during add
Previous Message Kevin Grittner 2013-08-01 20:24:05 Re: Why are stored procedures looked on so negatively?