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

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
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-09-30 00:00:00
Message-ID: CACJufxEkSyhOotK0b3hj_D3c9HO=dxGoGxL3Cx4j6enG_t_P6Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.
Please check the attached v16.

The condition for using indexscan to verify the column has not changed.
What changed: index_check_notnull logic simplifction, common helper
function: queue_notnull_validation
for setting up tab->constraints and tab->verify_new_notnull.

I also used the attached bench.txt to benchmark.

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
bench.txt text/plain 1.0 KB
v16-0001-using-indexscan-to-speedup-add-not-null-constraints.patch text/x-patch 20.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-09-30 00:02:42 Re: [PATCH] Clear FatalError earlier during crash restart
Previous Message Michael Paquier 2026-09-29 23:46:29 Re: injection_points: canceled or terminated waiters leak their wait slots