feature idea: use index when checking for NULLs before SET NOT NULL

Поиск
Список
Период
Сортировка
От John Bachir
Тема feature idea: use index when checking for NULLs before SET NOT NULL
Дата
Msg-id 7fc87d44-82de-4592-9cca-14536af274c3@www.fastmail.com
обсуждение исходный текст
Ответы Re: feature idea: use index when checking for NULLs before SET NOT NULL  (Sergei Kornilov <sk@zsrv.org>)
Список pgsql-hackers
There's the age-old problem of SET NOT NULL being impossible on large actively used tables, because it needs to lock
thetable and do a table scan to check if there are any existing NULL values. I currently have a table that's not
particularlyhuge but a scan takes 70 seconds, which causes unacceptable downtime for my entire application.
 

Postgres is not able to use an index when doing this check: https://dba.stackexchange.com/questions/267947

Would it be possible to have Postgres use an index for this check? Given the right index, the check could be instant
andthe table would only need to be locked for milliseconds.
 

(I'm sure I'm not the first person to think of this, but I couldn't find any other discussion on this list or
elsewhere.)

Thanks for reading!
John



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

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: SIGSEGV from START_REPLICATION 0/XXXXXXX in XLogSendPhysical() at walsender.c:2762
Следующее
От: John Naylor
Дата:
Сообщение: Re: speed up unicode normalization quick check