Thread
-
Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Laurenz Albe <laurenz.albe@cybertec.at> — 2025-10-23T20:38:11Z
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