Re: stored proc vs sql query string

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: stored proc vs sql query string
Date: 2006-04-06 10:39:31
Message-ID: C05A6823.9818%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/6/06 12:12 AM, "surabhi.ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> wrote:

> i have heard somewhere that writing a stored procedure, is much better than
> firing a sql query(such as select * from table_name) onto the database.
> is it true and if yes how?

This isn't going to be true most of the time, I think. Write SQL where you
can, and where you can't (because you can't express something in SQL), write
a procedure. There are places where using a stored procedure can be more
efficient, but I think starting with SQL, benchmarking and testing, and then
determining what queries need special attention is the best way to go at the
beginning.

> also i want to know that is the performnance in java slower as compared to
> cpp, given that the same things is being done.

Java and cpp performance are not really related to postgresql performance.
You will probably need to ask that on another list. There are many other
reasons to choose one language over another besides speed (in fact, I think
speed is probably not the first thing to think about when choosing a
language).

Sean

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2006-04-06 11:02:02 Re: Why postgres install requires physical access to
Previous Message chris smith 2006-04-06 08:53:17 Re: pgcrypto-crypt