Quickly making a column non-nullable (without a table scan)

From: Joe Van Dyk <joe(at)tanga(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Quickly making a column non-nullable (without a table scan)
Date: 2012-12-14 20:11:05
Message-ID: CACfv+pJc2F-QTV7xiCJ7+Pdmvc3WFTEakm_TONY6o82M3H4GVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have an index on a column that can be nullable. I decide the column
shouldn't be nullable anymore. So I alter the column to be not
nullable.

That "alter column" query does a full table scan, which can be painful
for large tables. Couldn't that index be used instead?

Thanks,
Joe

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-12-14 20:14:26 Re: initdb error
Previous Message Emi Lu 2012-12-14 20:10:47 Re: JDBC to load UTF8@psql to latin1@mysql