From: | Mark Lubratt <mark(dot)lubratt(at)indeq(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Multiple inserts without COPY |
Date: | 2004-03-04 02:50:27 |
Message-ID: | B1385542-6D86-11D8-BC23-000A9579AF50@indeq.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-03-04 04:22:35 | Re: Multiple inserts without COPY |
Previous Message | Tom Lane | 2004-03-03 23:19:19 | Re: bizarre AGE behaviour |