From: Mark Lubratt <mark.lubratt@indeq.com>
To: pgsql-admin@postgresql.org
Subject: Multiple inserts without COPY
Date: Wed, 3 Mar 2004 20:50:27 -0600
Message-ID: <B1385542-6D86-11D8-BC23-000A9579AF50@indeq.com> (raw)
Hello!
I have a routine in my application where I have the potential to
generate hundreds of inserts or deletes at one time. Right now, I
issue each insert and delete separately. I'm hoping there might be a
way of generating a single SQL statement to send to the backend for
each. The deletes look something like
delete from CL where CL_id = i
where i could be a list of several hundred integers. Again, right now
I iterate through the list.
The inserts might look like
insert into CL (CO_id, PE_ID) values (j, k)
where j and k are also integers and I could have a list of several
hundred pairs of j and k.
MySQL has a multiple insert feature where you simply append a bunch of
(j, k)'s separated by a comma. Does PostgreSQL have anything like
this? I was hoping I might be able to use COPY, but I see that's
really only for psql.
Are there any options? Or, do I simply send a bunch of queries?
Thanks!
Mark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mark.lubratt@indeq.com
Subject: Re: Multiple inserts without COPY
In-Reply-To: <B1385542-6D86-11D8-BC23-000A9579AF50@indeq.com>
References: <B1385542-6D86-11D8-BC23-000A9579AF50@indeq.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox