Re: simple update queries take a long time - postgres 8.3.1 - Mailing list pgsql-general

From mark
Subject Re: simple update queries take a long time - postgres 8.3.1
Date
Msg-id 82fa9e310803311238l31144008na39bfbb631ce72e8@mail.gmail.com
Whole thread Raw
In response to Re: simple update queries take a long time - postgres 8.3.1  (Raymond O'Donnell <rod@iol.ie>)
Responses Re: simple update queries take a long time - postgres 8.3.1  (Raymond O'Donnell <rod@iol.ie>)
Re: simple update queries take a long time - postgres 8.3.1  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general

On Mon, Mar 31, 2008 at 12:23 PM, Raymond O'Donnell <rod@iol.ie> wrote:
On 31/03/2008 20:16, mark wrote:
> is the query I am running , and it takes over 10 seconds to complete
> this query...
>
>
> update users set number_recieved=number_recieved+1 where uid=738889333;
>
> table has about 1.7 million rows.. i have an index on column uid and
> also on number_received. .. this is also slowing down the inserts that
> happen.

Are you VACUUMing the table regularly?
I have this setting  on in postgresql.conf.. I dont manually do vaccum..
 
autovacuum = on                 # Enable autovacuum subprocess?  'on'


 
Also, can you show us the EXPLAIN ANALYZE output from the query?

EXPLAIN ANALYZE update users set number_recieved=number_recieved+1 where uid=738889333;
                                                    QUERY PLAN
------------------------------------------------------------------------------------------------------------------
 Index Scan using idx_uid on users  (cost=0.00..8.46 rows=1 width=1073) (actual time=0.094..0.161 rows=1 loops=1)
   Index Cond: (uid = 738889333)
 Total runtime: 11479.053 ms
(3 rows)

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: simple update queries take a long time - postgres 8.3.1
Next
From: Vivek Khera
Date:
Subject: Re: PostgreSQL Replication with read-only access to standby DB