Re: Is it possible to speed up addition of "not null"?

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is it possible to speed up addition of "not null"?
Date: 2012-02-02 15:11:35
Message-ID: 20120202151135.GC388@crankycanuck.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)crankycanuck(dot)ca

In response to

Browse pgsql-general by date

  From Date Subject
Next Message david.sahagian 2012-02-02 17:03:20 9.0 EXPLAIN Buffers: written=nnnn
Previous Message Adrian Klaver 2012-02-02 15:07:09 Re: [GENERA]: Postgresql-9.1.1 synchronous replication issue