Обсуждение: PREPARED ...

Поиск
Список
Период
Сортировка

PREPARED ...

От
"alex b."
Дата:
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.


Re: PREPARED ...

От
"Nigel J. Andrews"
Дата:
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