Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id EE08B9F938C for ; Tue, 5 Dec 2006 16:07:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 72172-03 for ; Tue, 5 Dec 2006 16:07:12 -0400 (AST) X-Greylist: delayed 04:21:58.855882 by SQLgrey-1.7.4 Received: from mailbackup.inode.at (mailbackup.inode.at [213.229.60.24]) by postgresql.org (Postfix) with ESMTP id 7284D9F9FDA for ; Tue, 5 Dec 2006 16:07:20 -0400 (AST) Received: from [62.99.145.6] (port=13162 helo=mx.inode.at) by mailbackup.inode.at with esmtp (Exim 4.62) (envelope-from ) id 1GrcTv-00075n-Tl for pgsql-performance@postgresql.org; Tue, 05 Dec 2006 16:45:19 +0100 Received: from [83.64.182.18] (port=7405 helo=panettone.apus.local) by smartmx-06.inode.at with esmtp (Exim 4.50) id 1GrcTg-0004uI-A5; Tue, 05 Dec 2006 16:45:04 +0100 Received: from xjens.apus.local ([193.1.1.148]) by panettone.apus.local with esmtp (Exim 3.35 #1 (Debian)) id 1GrcTf-0006hl-00; Tue, 05 Dec 2006 16:45:03 +0100 Date: Tue, 05 Dec 2006 16:45:25 +0100 To: "Sven Geisler" , pgsql-performance@postgresql.org Subject: Re: single transaction vs multiple transactions From: "Jens Schipkowski" Organization: APUS Software GmbH Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <45758FBF.2030404@aeccom.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <45758FBF.2030404@aeccom.com> User-Agent: Opera Mail/9.02 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200612/94 X-Sequence-Number: 22150 Hi, PostgreSQL offers some proprietary SQL parameters and commands which = easily solves such problems. If you are sure PostgreSQL is the DB for your app forever ;) , you could= = use this parameters and commands. Here a possible resolution for your problem. DELETE FROM x USING tmp WHERE x.y=3Dtmp.z; Please read the extensive documentation of PostgreSQL first, before = posting. CU, Jens On Tue, 05 Dec 2006 16:26:55 +0100, Sven Geisler = wrote: > Hi, > > I have to refactoring a 'DELETE FROM x WHERE y IN (...)' because IN go= t > to much parameters. =3D> 'stack depth limit exceeded' > I don't want to increase just the parameter for max_stack_depth. It is= > better to refactoring because the number of arguments to IN may increa= se > in the future. > > My approach is to do multiple 'DELETE FROM x WHERE y=3D...'. > > My question is now, what is better for PostgreSQL from a performance > perspective? > 1. all multiple deletes in one transaction > 2. each delete in its own transaction > > The number of arguments is around 10,000. > > BTW: The arguments are generate in the application tier. I would have = to > create a temporary table which I can use in 'DELETE FROM x WHERE y IN > (SELECT z FROM tmp)'. > > Cheers > Sven > > ---------------------------(end of broadcast)-------------------------= -- > TIP 2: Don't 'kill -9' the postmaster -- = ** Dipl.-Designer Jens Schipkowski APUS Software GmbH