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 382BFD1D1E1 for ; Thu, 4 Mar 2004 04:23:14 +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 07790-05 for ; Thu, 4 Mar 2004 00:22:57 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 0E642D1CC78 for ; Thu, 4 Mar 2004 00:22:44 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i244MZrm021229; Wed, 3 Mar 2004 23:22:35 -0500 (EST) To: Mark Lubratt Cc: pgsql-admin@postgresql.org Subject: Re: Multiple inserts without COPY In-reply-to: References: Comments: In-reply-to Mark Lubratt message dated "Wed, 03 Mar 2004 20:50:27 -0600" Date: Wed, 03 Mar 2004 23:22:35 -0500 Message-ID: <21228.1078374155@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/19 X-Sequence-Number: 12589 Mark Lubratt writes: > 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. Consider delete from CL where CL_id in (i,j,k,...); If you have hundreds of target values, it might be better to put them in a temp table and go delete from CL where CL_id in (select id from temp_table); The latter should be reasonably quick in 7.4, but be warned that it'll suck in prior releases. > 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? That is SQL-spec syntax, but we've not gotten around to implementing it. COPY is a lot faster for bulk inserts. > I was hoping I might be able to use COPY, but I see that's > really only for psql. Huh? You can use COPY FROM STDIN in most of our client libraries, certainly so with libpq. What are you using? regards, tom lane