Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id C9E839F9398 for ; Tue, 5 Dec 2006 11:59:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 40369-06 for ; Tue, 5 Dec 2006 11:58:28 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by postgresql.org (Postfix) with ESMTP id 5711A9F938C for ; Tue, 5 Dec 2006 11:58:35 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id B09851CBE9; Tue, 5 Dec 2006 16:58:33 +0100 (CET) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 04140-02-21; Tue, 5 Dec 2006 16:58:32 +0100 (CET) Received: from [192.168.2.140] (andes.core.aeccom.com [192.168.2.140]) by mail.aeccom.com (Postfix) with ESMTP id D871F1CBE8; Tue, 5 Dec 2006 16:58:32 +0100 (CET) Message-ID: <45759726.9060004@aeccom.com> Date: Tue, 05 Dec 2006 16:58:30 +0100 From: Sven Geisler Organization: AEC/communications GmbH User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: Heikki Linnakangas CC: pgsql-performance@postgresql.org Subject: Re: single transaction vs multiple transactions References: <45758FBF.2030404@aeccom.com> <457590A3.2090006@enterprisedb.com> <457591B7.80408@aeccom.com> <45759381.40909@enterprisedb.com> In-Reply-To: <45759381.40909@enterprisedb.com> X-Enigmail-Version: 0.94.1.2 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at aeccom.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/81 X-Sequence-Number: 22137 Hi, Many thanks for the fast response. I will use temporary table with copy. Other issue I have is the connection between app and db. I guess, the approach with the copy will also hold down the network I/O between app and db. Keeping in mind that I produce 10,000+ statements. Thx Sven Heikki Linnakangas schrieb: > Sven Geisler wrote: >> I have to insert my arguments to a temporary table first, because the >> arguments are only known in the application tier. >> Is a multiple insert to a temporary table and a final 'DELETE FROM x >> WHERE y IN (SELECT z FROM tmp)' faster than multiple deletes? > > If the number of records is high, it most likely is faster. You should > try it with your data to be sure, but in general doing all the deletes > in one batch is faster when the number of records is high because it > allows using efficient merge joins or sequential scans. > > Populating the temporary table with no indexes should be quite > inexpensive if you make sure you don't do it one record at a time. Use > the COPY command or batched inserts instead. > >