Skip site navigation (1) Skip section navigation (2)

Re: Deleting one record from a table taking 17s.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rod Taylor <rbt(at)rbt(dot)ca>
Cc: Yusuf <yusuf0478(at)netscape(dot)net>,pgsql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Deleting one record from a table taking 17s.
Date: 2003-06-20 16:59:00
Message-ID: 18890.1056128340@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Rod Taylor <rbt(at)rbt(dot)ca> 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

In response to

pgsql-performance by date

Next:From: YusufDate: 2003-06-20 17:06:42
Subject: Re: Deleting one record from a table taking 17s.
Previous:From: Rod TaylorDate: 2003-06-20 16:06:03
Subject: Re: Deleting one record from a table taking 17s.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group