Re: DELETE queries slow down

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: "Galantucci Giovanni" <Giovanni(dot)Galantucci(at)italtel(dot)it>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: DELETE queries slow down
Date: 2007-09-17 10:21:44
Message-ID: 873axdpp6v.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:

> Galantucci Giovanni wrote:
>
>> For 1 or 2 hours we update only one table, and everything goes ok, where
>> DELETE last at most 6 or 7 seconds.
>>
>> Then for a minute we do INSERT on both table, and everything continue
>> going ok, with DELETE that last about 10 seconds.
>>
>> From that moment on, DELETES become timeless, and last for 240 and more
>> seconds!

What do the inserts and deletes actually look like? Are there subqueries or
joins or are they just inserting values and deleting simple where clauses?

And are these in autocommit mode or are you running multiple commands in a
single transaction?

Generally it's faster to run more commands in a single transaction but what
I'm worried about is that you may have a transaction open which you aren't
committing for a long time. This can stop vacuum from being able to clean up
dead space and if it's in the middle of a query can actually cause vacuum to
get stuck waiting for the query to finish using the page it's using.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ruben Rubio 2007-09-17 12:00:59 Re: [Again] Postgres performance problem
Previous Message Heikki Linnakangas 2007-09-17 09:18:46 Re: DELETE queries slow down