X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 36464475E91 for ; Fri, 18 Apr 2003 10:47:12 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 7A4CE475458 for ; Fri, 18 Apr 2003 10:47:11 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 04455D619; Fri, 18 Apr 2003 07:47:15 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id EE18D5C02; Fri, 18 Apr 2003 07:47:15 -0700 (PDT) Date: Fri, 18 Apr 2003 07:47:15 -0700 (PDT) From: Stephan Szabo To: Tom Lane Cc: Kevin Brown , Subject: Re: [PERFORM] Foreign key performance In-Reply-To: <20030417231421.O97534-100000@megazone23.bigpanda.com> Message-ID: <20030418073753.B1912-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-25.8 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/691 X-Sequence-Number: 38181 [Not sure this really is relevant for -performance at this point] On Thu, 17 Apr 2003, Stephan Szabo wrote: > On Fri, 18 Apr 2003, Tom Lane wrote: > > > Stephan Szabo writes: > > > It appears (from some not terribly scientific experiments - see below) > > > that it's likely to be related to managing the deferred trigger queue > > > given that in my case at least running the constraints non-deferred was > > > negligible in comparison. > > > > At one time the deferred-trigger queue had an O(N^2) behavioral problem > > for large N = number of pending trigger events. But I thought we'd > > fixed that. What's the test case exactly? Can you get a profile with > > gprof? > > I'm going to tomorrow hopefully - but it looks to me that we fixed one, but Argh. I'm getting that state where gprof returns all 0s for times. I'm pretty sure this has come up before along with how to get it to work, but I couldn't find it in the archives. Someday I'll learn how to use gprof. :( In any case, the call list seemed reasonable. It's currently doing O(n^2) calls to MemoryContextReset and deferredTriggerCheckState in InvokeEvents I don't see anything else that's at that kind of number of calls (50 million calls for a backend that's only done 10000 inserts stands out a bit). Going only from last statement seems to make it linear (I think my attempt is checking 1 too many trigger values, need to change that probably).