Re: Is there any technical reason why "alter table .. set not null" can't use index?

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Is there any technical reason why "alter table .. set not null" can't use index?
Дата
Msg-id 20210908051453.GB20274@depesz.com
обсуждение исходный текст
Ответ на Re: Is there any technical reason why "alter table .. set not null" can't use index?  (Alexander Kukushkin <cyberdemn@gmail.com>)
Ответы Re: Is there any technical reason why "alter table .. set not null" can't use index?  (Gus Spier <gus.spier@gmail.com>)
Список pgsql-general
On Wed, Sep 08, 2021 at 07:09:31AM +0200, Alexander Kukushkin wrote:
> Hi,
> 
> On Wed, 8 Sep 2021, 06:59 hubert depesz lubaczewski, <depesz@depesz.com>
> wrote:
> 
> > Hi,
> > we needed recently to add not null constraint on some fields, and it
> > struck me that it took long.
> > Obviously - pg has to check the data. But it seems that it can't use
> > index.
> >
> 
> It can't use the index, but can use an already existing CHECK CONSTRAINT,
> that could be created as NOT VALID and validated without holding heavy
> locks. After adding not null you can drop the constraint.

Thanks. Forgot about these.

Best regards,

depesz




В списке pgsql-general по дате отправления:

Предыдущее
От: Alexander Kukushkin
Дата:
Сообщение: Re: Is there any technical reason why "alter table .. set not null" can't use index?
Следующее
От: Jehan-Guillaume de Rorthais
Дата:
Сообщение: Re: prevent WAL replication to fill filesystem