Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piHHO-0007wp-MU for pgsql-general@arkaria.postgresql.org; Fri, 31 Mar 2023 16:07:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1piHHN-0002KW-EU for pgsql-general@arkaria.postgresql.org; Fri, 31 Mar 2023 16:07:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piHHN-0002KN-3w for pgsql-general@lists.postgresql.org; Fri, 31 Mar 2023 16:07:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1piHHL-0006GS-0D for pgsql-general@lists.postgresql.org; Fri, 31 Mar 2023 16:07:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32VG6xdF560123; Fri, 31 Mar 2023 12:06:59 -0400 From: Tom Lane To: Siddharth Jain cc: Laurenz Albe , pgsql-general@lists.postgresql.org Subject: Re: Question on creating keys on partitioned tables In-reply-to: References: Comments: In-reply-to Siddharth Jain message dated "Fri, 31 Mar 2023 08:53:41 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <560121.1680278819.1@sss.pgh.pa.us> Date: Fri, 31 Mar 2023 12:06:59 -0400 Message-ID: <560122.1680278819@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Siddharth Jain writes: > I think the two are equivalent. If not, could you please explain why? Well, they're formally equivalent if you require there to be only one X value per partition (ie, PARTITION BY LIST with only one listed value per partition); if there's more, they're not the same thing. Neither one guarantees that Y is globally unique. We have no mechanism for enforcing uniqueness across partitions except for partition key columns. regards, tom lane