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 1tDhHY-002aRe-SA for pgsql-general@arkaria.postgresql.org; Wed, 20 Nov 2024 09:45:56 +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 1tDhHX-004905-7X for pgsql-general@arkaria.postgresql.org; Wed, 20 Nov 2024 09:45:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDhHW-0048xI-Ph for pgsql-general@lists.postgresql.org; Wed, 20 Nov 2024 09:45:54 +0000 Received: from mail-vk1-xa36.google.com ([2607:f8b0:4864:20::a36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDhHU-002u0l-Hf for pgsql-general@lists.postgresql.org; Wed, 20 Nov 2024 09:45:54 +0000 Received: by mail-vk1-xa36.google.com with SMTP id 71dfb90a1353d-5101c527611so1683036e0c.3 for ; Wed, 20 Nov 2024 01:45:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732095950; x=1732700750; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pmPe4wnTKdkPjafOjdJzP+R9Er0ASCok/FemzsMY5PQ=; b=jskBMKE0s8PXatGjqTLDEBhYz1ljTdzLrRmXGWSinBJ6g5hh63YJF0H/BaE0kK7vwJ 3RFzM7xlPHej+4f8lfG0wkko7N9PeycoKvvw8itN6+fReJ4GwI3EOvgH1kgz5UxjzWpj a2EGzD7iOQBHdk0Bijaj7TI47D6xCGGaJYboZ+w6grKSBTdC7I7I7h+O5xEkzqs/UgS2 uJRIVa5rWgstI3PicqyR3OTkiN5OPHLs7LNdxxfKyTsLOvzsajTQ3VVapKm1qguxfrnZ 3TYXBAsz8qGoEnxswx9md+1l2WI5DUCYZqqE9dylbQwkyt8I3CcOF6Vq2VeQ87+rGGsG sbLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732095950; x=1732700750; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pmPe4wnTKdkPjafOjdJzP+R9Er0ASCok/FemzsMY5PQ=; b=PRAD39QWaqURins+2YxCqCVvgC1N9g5x4X2SjXjnkjNu6ORMJ7NDQNkdZIOkKKu5Cj w36QScdIpC455AzbWzwPaBMIzOu3SD8o3eTnVBLB2WDMEUL1mRbE5wiHt8C65Hj/2liB YELD7XmLUmoq46lsM1ztcn756zZRqpgzsChXXVYF2XakN+mA9yg7S0mXSTOZEjWmAXkG FwnSFuFmXG+M1tEf8BqjfbBFOhgRxcTlkMUTQTax53cX7fCQc+34cGDmxqhTYGQu0siV K6bMGL6QE4Kv1j51XwoPvdhd73XUU/o6vpRi2uxOko2dMbcXrxxr2PPbPnUL5qPrYn8s p2lA== X-Gm-Message-State: AOJu0YwmFBRR/9LnC9+dzJO8GtWv/VgFeEMXIiwg0fdv63nnnN/FbhDS TJrRNuw8bZtOxIKRhE3Mv5yJ8aZ6C0rRcISFr7exRa2p/XNKh8Ko3N0vNLLRwJwM15YbQR1jGV8 pWPPi+FfbBM83QLv7b/6rfj0PAgw= X-Google-Smtp-Source: AGHT+IF93VMO+Gxmh12EmPlaoWqdr+lb/pqubFew7FRWVpuqeOuh9psSoJ5/bylTePV+oLcPD8SQIbR1hsQDH9GaCRI= X-Received: by 2002:a05:6122:c96:b0:50a:cb38:31d5 with SMTP id 71dfb90a1353d-514cfb6da15mr1976070e0c.12.1732095950577; Wed, 20 Nov 2024 01:45:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: jian he Date: Wed, 20 Nov 2024 17:45:39 +0800 Message-ID: Subject: Re: Validating check constraints without a table scan? To: Philip Couling Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Nov 15, 2024 at 4:38=E2=80=AFPM Philip Couling = wrote: > > Is there a solid reason why adding a check constraint does not use existi= ng indexes for validation. > can you give an sql example (except not-null) where indexes can be used for check constraint validation? i am not sure I understand it correctly.