Re: using index to speedup add not null constraints to a table

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: using index to speedup add not null constraints to a table
Date: 2026-01-31 17:20:14
Message-ID: 202601311716.jeczqdjsmh57@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2026-01-31 18:00:00 Re: Allow GUC settings in CREATE SUBSCRIPTION CONNECTION to take effect
Previous Message Sami Imseih 2026-01-31 17:16:03 Re: Flush some statistics within running transactions