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

2025-10-24 Thread Jonathan Reis
Great point. One of the main reasons we are using partitioning is to quickly drop partitions containing old data so we wouldn't be implementing foreign key constraints any way. On Thu, Oct 23, 2025 at 10:04 PM Laurenz Albe wrote: > On Fri, 2025-10-24 at 11:54 +1300, David Rowley wrote: > > On Fr

Performance implications of partitioning by UUIDv7 range in PostgreSQL v18

2025-10-22 Thread Jonathan Reis
Hello PostgreSQL performance team, I’m evaluating the new UUIDv7 type in PostgreSQL v18 and would like advice on its suitability for time-based partitioning and related planner behavior. *Context* I have a large message/event table where each row is identified by a uuidv7 primary key. Because UUI

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

2025-10-23 Thread Jonathan Reis
Greg, 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)); whereas, this is create ta

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

2025-10-23 Thread Jonathan Reis
Thank you all for your input on this. Here is a summary of what I have learned from you all. Approach 1: partition on uuid_extract_timestamp(id) Pros: No need for custom function to convert from timestamptz to uuidv7 Partitions are human-readable Can use pg_partman Cons: Cannot have a