Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9K2x-000VLK-9F for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 08:41:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u9K2u-00CotA-N5 for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2025 08:41:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9K2t-00Cot2-TL for pgsql-hackers@lists.postgresql.org; Mon, 28 Apr 2025 08:41:01 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u9K2r-002OT3-31 for pgsql-hackers@lists.postgresql.org; Mon, 28 Apr 2025 08:40:59 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9107811401E7; Mon, 28 Apr 2025 04:40:56 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 28 Apr 2025 04:40:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1745829656; x= 1745916056; bh=LcAr6aFcxxOuCw21llHBJf6QoCL16+wR4gV+KzWfQfA=; b=G 6fkrWrlc0ucZ11Qp+9RZ+HBMNtIzgTWEeKTX2tvit9e7jjHIs27ZjVaq3H8ScSGg MdA4e25BQ6BQdImH/PiqM2Y48s2P44jlkblQgN/SR63OMZ3pxrC2bjKRpYP2Y7by U1hmn7Hn79smqIHjedL4k6U92YXtV4SLz6pZgvESD9E4noED7fboL7pXwCNg/a6o VsRvbDjyofVnCATtnIbdTGhLady/18AG8QmigCqKI+4UvV8M9GhDuAMUkHYxRfme ulsKhILKBAxiuXIcF1sVHj15Hy3ej18814Q3xgIRPfk8wRGW1OHJ1muim+CcAY+I HiChw6oawKxWb3PIIhnvw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1745829656; x=1745916056; bh=L cAr6aFcxxOuCw21llHBJf6QoCL16+wR4gV+KzWfQfA=; b=I2z90UMBxOSJo1D7V WNFLCbWZFiR9JF8wN1HRbwZkxZ4n34h2YYOkgPHx5TpQ2R1rwfxPYDTuoVVqCaXS rsSHhWRJHGyefrxUvQ663ljeCfltswKbXE75Gyyx3QVcZzjvaghCRHZwym9CtzOF QF0PEy8Mtl1XtepBGyHRt7+e3PnXERkaf0OGVzqNakr1WImHwvV5WMFWKkoFmfee 6bWY7EFSU17LlYZqYy11qQwcr4LCJj6FeUfcxnhYGmRgTHz8w5epyLCa+T2MCPfy HijhqvedvCeiq9tF0zMtYkLHQ+xVazQrl36/BKrJa9GUq2VF0J49weMZL64iMz0H yAYLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddviedtgeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddt jeenucfhrhhomheplmhlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuh hrihhlvghmuhdruggvqeenucggtffrrghtthgvrhhnpeetuedvheffkeevgfeuheevteev kefggedttdeufeeuheduuddthfeffffhjeefffenucffohhmrghinhepvghnthgvrhhprh hishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomheprghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtth hopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjihgrnhdruhhnihhvvghr shgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvg hrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Apr 2025 04:40:55 -0400 (EDT) Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 7F5B390; Mon, 28 Apr 2025 10:40:53 +0200 (CEST) Date: Mon, 28 Apr 2025 10:40:53 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: jian he Cc: PostgreSQL Hackers Subject: Re: using index to speedup add not null constraints to a table Message-ID: <202504280840.vmqn6igfmeuh@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Apr-28, jian he wrote: > for tests, just found out i can imitate > src/test/modules/test_misc/t/001_constraint_validation.pl, > > So I created a file: > src/test/modules/test_misc/t/008_indexscan_validate_notnull.pl > for TAP tests. Seems reasonable, didn't look at it in detail. I think you don't have any tests where you try to set multiple columns as NOT NULL in a single ALTER TABLE command; I think this is worth having. Something like CREATE TABLE foo (col1 int, col2 int, col3 int); ... create indexes on col1 and col2 ... alter table foo set col1 not null, set col3 not null, add constraint bla not null b; and stuff like that. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "If you have nothing to say, maybe you need just the right tool to help you not say it." (New York Times, about Microsoft PowerPoint)