Re: using index to speedup add not null constraints to a table
Álvaro Herrera <alvherre@kurilemu.de>
From: Álvaro Herrera <alvherre@kurilemu.de>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-31T17:20:14Z
Lists: pgsql-hackers
On 2026-Jan-16, jian he wrote: > In this case, scanning the t3_copy_idx index to check these four NOT NULL > constraints is actually slower than a full table scan. > > Therefore, I further restricted the use of the index-scan mechanism for fast NOT > NULL verification to scenarios where the attribute being checked is the leading > column of the index. Makes sense. > I have not yet addressed all of your other comments, as this > represents a more of a > major change. Therefore, I am submitting the attached patch first. OK, this means we're still waiting then. Please do see my v8 patch. It contained other cleanups as well. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "La gente vulgar sólo piensa en pasar el tiempo; el que tiene talento, en aprovecharlo"