Re: Regarding use of single column as primary key on partitioned table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regarding use of single column as primary key on partitioned table
Date: 2024-09-28 04:55:06
Message-ID: 771900.1727499306@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-in-general

Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> On Sat, Sep 28, 2024 at 12:39 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>> On Friday, September 27, 2024, Durgamahesh Manne <
>>> Can't we use primary key on singal column(betid) on partitioned table
>>> rather than using composite key (placedon,betid)?

>> No. It would be misleading to allow such a thing because a unique index
>> can only span a single partition.

> That is IMO a serious (and probably unfixable, given how PG stores tables)
> flaw in PG's partitioning design.

You can call it a flaw if you want, but it's an intentional design
limitation. The only way to relax it would be to invent global
indexes (that is, single indexes covering the entire partitioning
tree), which would basically throw away every advantage of making
a partitioned structure in the first place. If that's what you
want, don't partition your table.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Durgamahesh Manne 2024-09-28 05:06:52 Re: Synchronize the dump with a logical slot with --snapshot
Previous Message Ron Johnson 2024-09-28 04:49:35 Re: Regarding use of single column as primary key on partitioned table

Browse pgsql-in-general by date

  From Date Subject
Next Message Durgamahesh Manne 2024-09-28 05:06:52 Re: Synchronize the dump with a logical slot with --snapshot
Previous Message Ron Johnson 2024-09-28 04:49:35 Re: Regarding use of single column as primary key on partitioned table