Re: Is it possible to speed up addition of "not null"? - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Is it possible to speed up addition of "not null"?
Date
Msg-id 20120202151135.GC388@crankycanuck.ca
Whole thread Raw
In response to Re: Is it possible to speed up addition of "not null"?  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
On Thu, Feb 02, 2012 at 02:20:59PM +0100, hubert depesz lubaczewski wrote>
> Sure. But at least theoretically, it could use index - for example, if
> I had index "where column is null".

To build that index, you had to visit every row too.  But I see what
your problem is.

> But this should be nearly instantenous. This machine is very busy. In
> the low-traffic moments we have ~ 5k transactions per second.

[. . .]

> This table is concurrently used. Taking it offline is not an option.

It's this.  You don't have low enough traffic to get the lock you need
on the table.  You're changing the schema of the table, and you need
to lock it while you do that.  Probably you're not getting the lock
you need granted and therefore it seems like it's taking a long time.

A

--
Andrew Sullivan
ajs@crankycanuck.ca

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERA]: Postgresql-9.1.1 synchronous replication issue
Next
From:
Date:
Subject: 9.0 EXPLAIN Buffers: written=nnnn