Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Jonathan Reis <jon(dot)reis(at)conevity(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: Olof Salberger <olof(dot)salberger(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Date: 2025-10-23 20:38:11
Message-ID: cc128c674065c06ebc0d1eb5e76fa2598e78c1c9.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 2025-10-23 at 13:11 -0700, Jonathan Reis wrote:
> Thank you very much for your recommendations and your sample code. I originally had it your way, but then I found out this is not possible
>
> create table message (
>   id uuid PRIMARY KEY
>   -- ... plus other columns
> ) partition by range (uuid_extract_timestamp(id));

That's because you want to make "id" a primary key, but you can only create a primary
key constraint on a partitioned table if the partitioning key is a subset of the
primary key.

I recommend that you create a primary key on each partition rather than having one
on the partitioned table.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Rowley 2025-10-23 22:54:04 Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Previous Message Jonathan Reis 2025-10-23 20:11:11 Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18