Re: DELETE queries slow down - Mailing list pgsql-performance

From Gregory Stark
Subject Re: DELETE queries slow down
Date
Msg-id 873axdpp6v.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: DELETE queries slow down  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Responses R: DELETE queries slow down
List pgsql-performance
"Heikki Linnakangas" <heikki@enterprisedb.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

pgsql-performance by date:

Previous
From: "Heikki Linnakangas"
Date:
Subject: Re: DELETE queries slow down
Next
From: Ruben Rubio
Date:
Subject: Re: [Again] Postgres performance problem