X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A46499FA1E2 for ; Tue, 5 Sep 2006 16:05:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 44569-07 for ; Tue, 5 Sep 2006 16:05:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 6CE819FB280 for ; Tue, 5 Sep 2006 15:45:01 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id k85IipwA052350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Sep 2006 12:44:53 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id k85Iiojd053721; Tue, 5 Sep 2006 12:44:51 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id k85IioZ8053720; Tue, 5 Sep 2006 12:44:50 -0600 (MDT) (envelope-from mfuhr) Date: Tue, 5 Sep 2006 12:44:50 -0600 From: Michael Fuhr To: "Cox, Brian" Cc: pgsql-jdbc@postgresql.org Subject: Re: "stack depth limit exceeded" executing DELETE FROM Message-ID: <20060905184450.GA41016@winnie.fuhr.org> References: <3240464A2687334E92AAB86DAB6504530132D21B@USILMS13.ca.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3240464A2687334E92AAB86DAB6504530132D21B@USILMS13.ca.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.177 tagged_above=0 required=5 tests=AWL, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/9 X-Sequence-Number: 15727 On Tue, Sep 05, 2006 at 02:18:05PM -0400, Cox, Brian wrote: > The following fails with a "stack depth limit exceeded": > > DELETE FROM some-table WHERE pk IN (pk1, pk2, ..., pkN) > > where pk = primary key and N is large, may be > 50000. > > Is there some limit as to the number of rows that can > be deleted in a single DELETE? The error isn't due to the number of rows being deleted but rather from parsing the large number of items in the IN list. See the following thread: http://archives.postgresql.org/pgsql-general/2006-01/msg00959.php How are you obtaining the N values? A subquery that returns the equivalent list should work. You could also try increasing max_stack_depth (or max_expr_depth in 7.4 and earlier), but be sure to stay within your system's stack depth resource limit. -- Michael Fuhr