Re: feature idea: use index when checking for NULLs before SET NOT NULL - Mailing list pgsql-hackers

From Darafei "Komяpa" Praliaskouski
Subject Re: feature idea: use index when checking for NULLs before SET NOT NULL
Date
Msg-id CAC8Q8tLqfDWACiGhi3WQac1h4SyHGSOYy6t88F=6aMB4cuwaSA@mail.gmail.com
Whole thread Raw
In response to Re: feature idea: use index when checking for NULLs before SET NOT NULL  (Oleksandr Shulgin <oleksandr.shulgin@zalando.de>)
List pgsql-hackers


John, I think it's worth pointing out that Postgres most likely does a full table scan to validate a constraint by design and not in optimization oversight.  Think of what's gonna happen if the index used for checking is corrupted?


This can't be true: a corrupted index is a failure mode, and failure modes are not expected in normal flow. Think of it this way: we must never use index scan, because if index is corrupted the results are going to be disastrous, so we will always do Seq Scans.

It's ok to assume index is not corrupted.

 

--
Darafei Praliaskouski

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: OpenSSL 3.0.0 compatibility
Next
From: Tomas Vondra
Date:
Subject: Re: Trouble with hashagg spill I/O pattern and costing