Re: feature request - adding columns with default value - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: feature request - adding columns with default value
Date
Msg-id 20030404121334.GB20972@libertyrms.info
Whole thread Raw
In response to feature request - adding columns with default value  ("Henrik Steffen" <steffen@city-map.de>)
List pgsql-general
On Fri, Apr 04, 2003 at 10:08:50AM +0200, Henrik Steffen wrote:
> it takes about 10 minutes to perform this update, and for about 6 minutes
> all other updates to the table are in status "waiting", this leads to
> a very high load and all max_connection setting is reached soon
> (on a Dual-Xeon 2.4 GHz machine with 2 GB RAM)
>
> i would suggest to change the "alter table add column" function to
> adding a default value while adding the column if this is possible
> and if this minimizes "down-time".

Why do you think that having the back end set the default value on
those other rows won't sugger the very same problem?  What esle is it
to do except implicitly iees the same UPDATE you do?

One way around this problem is to write a little script (I use perl
for this, but pick your favourite flavour) which does the updates
1000 at a time.  This minimises the locking, so you don't have to
have anything WAITING for 10 minutes.

It also allows you to insert the occasional VACUUM so that your FSM
settings don't have to be huge.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Problem with odbc.sql
Next
From: Diogo de Oliveira Biazus
Date:
Subject: Re: feature request - adding columns with default value