Re: Dynamic prepare possible in plpgsql?

From: "Collin Peters" <cadiolis(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Dynamic prepare possible in plpgsql?
Date: 2007-05-01 16:52:52
Message-ID: df01c91b0705010952s4fb5fd5fpd9f4f61ff9673875@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a plpgsql function which is doing a loop over one table of user
data and then inserting that data in various tables. Example:

loop over user table (temp data)
insert into users1 table
insert into users2 table
etc....
end loop

Is it faster to use PREPARE for the various INSERT statements inside a
plpgsql function? Perhaps I am wrong and it does its PREPARE work
when the function is parsed.

Collin

On 4/30/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Collin Peters" <cadiolis(at)gmail(dot)com> writes:
> > Is it possible to have a dynamic PREPARE statement in plpgsql?
>
> Well, you could use plpgsql's EXECUTE to run SQL PREPARE and EXECUTE
> commands, but it seems awfully brute-force. What do you really need
> to accomplish here?
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jonah H. Harris 2007-05-01 17:16:42 Re: Dynamic prepare possible in plpgsql?
Previous Message Tom Lane 2007-05-01 00:52:22 Re: Dynamic prepare possible in plpgsql?