Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18 - Mailing list pgsql-performance

From Laurenz Albe
Subject Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Date
Msg-id cc128c674065c06ebc0d1eb5e76fa2598e78c1c9.camel@cybertec.at
Whole thread Raw
In response to Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18  (Jonathan Reis <jon.reis@conevity.com>)
Responses Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
List 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
thisis 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



pgsql-performance by date:

Previous
From: Jonathan Reis
Date:
Subject: Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Next
From: David Rowley
Date:
Subject: Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18