Re: Performance implications of partitioning by UUIDv7 range in PostgreSQL v18
Greg Sabino Mullane <htamfids@gmail.com>
From: Greg Sabino Mullane <htamfids@gmail.com>
To: Jonathan Reis <jon.reis@conevity.com>
Cc: David Rowley <dgrowleyml@gmail.com>,
Laurenz Albe <laurenz.albe@cybertec.at>, Olof Salberger <olof.salberger@gmail.com>,
pgsql-performance@lists.postgresql.org
Date: 2025-10-24T12:38:57Z
Lists: pgsql-performance
On Thu, Oct 23, 2025 at 10:14 PM Jonathan Reis <jon.reis@conevity.com>
wrote:
> Can't use pg_partman (this is true?)
>
Apologies, this warrants an explanation. It turns out I was wrong to be
concerned. I was worried about pg_partman being able to partition by the
decoded value of a column, but it already handles that quite well. From the
docs (where col3 is of type uuid):
SELECT partman.create_parent(
p_parent_table := 'partman_test.time_taptest_table'
, p_control := 'col3'
, p_interval := '1 day'
, p_time_encoder := 'partman.uuid7_time_encoder'
, p_time_decoder := 'partman.uuid7_time_decoder'
);
This also kind of answers your other question about your uuidv7_floor
function. While not native to Postgres, the uuid7_time_encoder function
used above is extremely similar to yours. See
https://github.com/pgpartman/pg_partman/blob/development/sql/functions/util_uuid7_time.sql
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support