Re: Performance problem on delete from for 10k rows. May takes 20 minutes through JDBC interface

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: David Gagnon <dgagnon(at)siunik(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance problem on delete from for 10k rows. May takes 20 minutes through JDBC interface
Date: 2005-03-15 23:38:34
Message-ID: 20050315233834.GA68209@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Mar 15, 2005 at 04:24:17PM -0500, David Gagnon wrote:

> Il get this strange problem when deleting rows from a Java program.
> Sometime (For what I noticed it's not all the time) the server take
> almost forever to delete rows from table.

Do other tables have foreign key references to the table you're
deleting from? If so, are there indexes on the foreign key columns?

Do you have triggers or rules on the table?

Have you queried pg_locks during the long-lasting deletes to see
if the deleting transaction is waiting for a lock on something?

> I rememeber having tried to delete the content of my table (IC) from
> PgAdminIII and I took couples of seconds!!! Not minutes.

How many records did you delete in this case? If there are foreign
key references, how many records were in the referencing tables?
How repeatable is the disparity in delete time? A single test case
might have been done under different conditions, so it might not
mean much. No offense intended, but "I remember" doesn't carry as
much weight as a documented example.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Brown 2005-03-15 23:41:07 Re: cpu_tuple_cost
Previous Message Mark Kirkwood 2005-03-15 22:44:06 Re: Changing the random_page_cost default (was: