X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D974A30EA8D for ; Fri, 20 Jun 2003 16:59:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 74924-08 for ; Fri, 20 Jun 2003 13:59:02 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id C564430E871 for ; Fri, 20 Jun 2003 13:59:01 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h5KGx0U6018891; Fri, 20 Jun 2003 12:59:00 -0400 (EDT) To: Rod Taylor Cc: Yusuf , pgsql-performance Subject: Re: Deleting one record from a table taking 17s. In-reply-to: <1056125163.41752.31.camel@jester> References: <3EF32DF8.3060900@netscape.net> <1056125163.41752.31.camel@jester> Comments: In-reply-to Rod Taylor message dated "20 Jun 2003 16:06:03 -0000" Date: Fri, 20 Jun 2003 12:59:00 -0400 Message-ID: <18890.1056128340@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200306/131 X-Sequence-Number: 2215 Rod Taylor writes: > On Fri, 2003-06-20 at 15:53, Yusuf wrote: >> Why would the following query take soo long to run? What does 28.12 msec = > represent, since the total running time is=20 >> 16801.86 ms. > I'd hazard to guess that you have a whole slew of foreign keys cascading > to delete, update, or check many rows from other tables. Either that or some other AFTER trigger(s) that are taking lots of time. Those fire after the end of the statement, so EXPLAIN's measurement of runtime fails to include them. Given that this query appears to have deleted only one row, though, you sure seem to have a mighty slow trigger. If it's an FK, perhaps you are missing an index on the referencing column? The system doesn't force you to have an index on that side of an FK, but it's generally a good idea. regards, tom lane