X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E594BD1C9D9 for ; Thu, 4 Mar 2004 02:50:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 85156-02 for ; Wed, 3 Mar 2004 22:50:33 -0400 (AST) Received: from secure.icanx.com (secure.icanx.com [64.246.58.55]) by svr1.postgresql.org (Postfix) with ESMTP id AAE56D1C9D0 for ; Wed, 3 Mar 2004 22:50:23 -0400 (AST) Received: from 63-229-201-197.mpls.qwest.net ([63.229.201.197] helo=[192.168.2.102]) by secure.icanx.com with esmtp (Exim 4.24) id 1AyiwQ-0000xG-Vu for pgsql-admin@postgresql.org; Wed, 03 Mar 2004 21:50:31 -0500 Mime-Version: 1.0 (Apple Message framework v612) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-admin@postgresql.org From: Mark Lubratt Subject: Multiple inserts without COPY Date: Wed, 3 Mar 2004 20:50:27 -0600 X-Mailer: Apple Mail (2.612) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - secure.icanx.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - indeq.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/18 X-Sequence-Number: 12588 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