Re: PREPARED ... - Mailing list pgsql-general

From Nigel J. Andrews
Subject Re: PREPARED ...
Date
Msg-id Pine.LNX.4.21.0305122036560.24875-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to PREPARED ...  ("alex b." <mailinglists1@gmx.de>)
List pgsql-general
On Mon, 12 May 2003, alex b. wrote:

> hi
>
> I'm pretty sure you people will want kill me for this, but I've heard
> quite a lot about prepared queries..
>
> well, the pgdocs don't really clarify or give examples on how to use
> this command.
>
> besides, is it even stored? if so, then, how do you delete it, view it,
> or modify it?
>
> and most importantly, how do you use them?
>
> I have this table, I want to add a few values usint INSERT INTO, but I
> heard using this command combined with prepare speeds things up a little
> - good, so I wanted to try it, but failed miserably... :(
>
> well, any help's appreciated.


I've not tried it since I don't want an error to kill my transactions, and at
the moment I don't want to change things to allow it, but one general idea is
you do something like:

loop {

    EXECUTE myname ...
    if error and error is about myname not a prepared query then
        PREPARE myname INSERT ...
}

Another would be:

PREPARE myname INSERT ...
loop {
    EXECUTE myname ...
}

Other than that I can't say whether the docs are correct in the details but I
can't say I would expect them to be wrong.

What is it you have tried and what are the errors?

Prepared queries are only prepared in individual backends.


--
Nigel J. Andrews


pgsql-general by date:

Previous
From: "alex b."
Date:
Subject: PREPARED ...
Next
From: Andrew Ayers
Date:
Subject: Re: VARCHAR performance issue