Re: Why Does UPDATE Take So Long?

From: Alan Hodgson <ahodgson(at)simkin(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why Does UPDATE Take So Long?
Date: 2008-09-30 19:14:05
Message-ID: 200809301214.05622@hal.medialogik.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 30 September 2008, Bill Thoen <bthoen(at)gisnet(dot)com> wrote:
> Working with PG 8.1 I'm trying to update a char(4) column, and it's
> taking a very long time; 15 minutes so far and no end in sight. From the
> explain, it doesn't seem like it should take that long, and this column
> is not indexed. Sure, there's 2.7 million records but it only takes a
> few minutes to scan the whole file. Is there some special overhead I
> should be aware of with an UPDATE? I VACUUMed and ANALYZEd first, too.

update creates new rows for all affected rows. If the table is indexed, it
creates new index rows for all affected rows in every index. Slow updates
is a common PostgreSQL complaint.

--
Alan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2008-09-30 19:20:52 Re: Why Does UPDATE Take So Long?
Previous Message Bill Thoen 2008-09-30 19:00:37 Why Does UPDATE Take So Long?