Quick select, slow update - help with performance problems - Mailing list pgsql-sql

From Gary Stainburn
Subject Quick select, slow update - help with performance problems
Date
Msg-id 200807011120.41664.gary.stainburn@ringways.co.uk
Whole thread Raw
Responses Re: Quick select, slow update - help with performance problems  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Hi folks.

My system is slowing down, more notably over the last few weeks.
The main reason is that it's on an old slow machine, and I'm in the process of 
sorting this.

However, I think that there are some issues within my database which I need to 
investigate.

There seems to be some performance issues with updating the database. I have a 
select, an insert  and an update based on the same table and condition.

The select:

select count(ud_id) from used_diary where ud_valet_completed is null and    ud_valet_required < CURRENT_DATE-'7
days'::interval;

completed in about a second. The insert

insert into used_diary_log (ul_u_id, ul_ud_id, ul_changes)select 25, ud_id, 'Valet automatically cleared down'     from
used_diary    where ud_valet_completed is null and         ud_valet_required < CURRENT_DATE-'7 days'::interval;
 

also completed in about a second. However the update 

update used_diary set ud_valet_completed=now(), ud_valet_completed_by=25 where ud_valet_completed is null and
ud_valet_required< CURRENT_DATE-'7 days'::interval
 

is still running after approx 1 1/2 minutes.  I've noticed that other updates 
also seem to take a long time.

Could I have any suggestions on how I could start looking into why this is.  
Could it be the config of postgresql, issues with my schema, or something 
else?

Gary


-- 
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     


pgsql-sql by date:

Previous
From: Gavin 'Beau' Baumanis
Date:
Subject: Re: distinct / group by assistance.
Next
From: Richard Huxton
Date:
Subject: Re: Quick select, slow update - help with performance problems