Re: PREPARE statements

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Andrei Reinus <andrei(dot)reinus(at)uptime(dot)ee>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: PREPARE statements
Date: 2005-04-05 10:27:30
Message-ID: b49edccda43f57fc50ab61b7099ecb22@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Apr 5, 2005, at 1:33 AM, Andrei Reinus wrote:

> Hi,
>
> I have few questions about PREPARE statements.
> As starting a new project, I always try to find ways to 'do-it-right'
> and application is
> all OLTP style system.
>
> I have lots of queries like "SELECT name FROM client WHERE id = 1".
> Plain and simple PK index search.
> To save parsing/rewriting/planning overhead I should use PREPARE
> statements, right?
>

I'm not an expert here, so listen for others to weigh in. However, if
you are executing the prepared statement more than once per connection,
that is true....

> Manual states that prepare statements are only stored in database
> session,
> is there are way to be sure that statement exists or make it last over
> all sessions?

How about a stored procedure?

> I cant PREPARE statments over and over again with every page request,
> right?

Are you in a persistent environment where you can reuse the same
database connection?

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Eduardo Vázquez Rodríguez 2005-04-05 18:44:50 Postgres Out of Memory
Previous Message Tom Lane 2005-04-05 07:46:18 Re: Problems with initdb