Fun with UUIDs
summary
UUIDs store 16 bytes so the talk demonstrates encoding tenant, time and object bits into them, shows a simple Postgres SQL implementation plus a C extension, and measures real effects: UUID indexes are about double the index size, a sequential bigint index hits ~27,000 shared buffers while random UUID index hits 9.5 million buffer hits, and a Java benchmark of 10 million inserts shows UUID schemes perform similarly to random 64‑bit integers (sequential still fastest). Using UUID v7 time prefix or custom time‑first layouts restores locality, partitioning by time works, tenant list partitioning is limited by constraint exclusion, and the C extension is only ~25% faster than the SQL approach.
AI-written summary · about
chapters (14)
- 0:00Introduction and welcome
- 1:47Speaker introduction
- 2:51What is a UUID
- 5:21UUIDs in PostgreSQL
- 6:04Problems with random UUIDs
- 8:12Benchmarking UUID performance
- 12:32Advantages of using UUIDs
- 15:44Encoding data into UUIDs
- 18:33UUID v7 and flexible UUIDs
- 23:59Generating custom UUIDs in SQL
- 26:50Decoding and extracting UUID data
- 28:55Partitioning and tenant sharding
- 31:02C extension for UUID operations
- 32:54Q&A session
related talks
24mFun With UUIDs
29mWhy UUIDs are Secretly Incredibly Fascinating
34mUnconventional ways to index UUIDs in PostgreSQL
57mUnderstanding Advanced Datatypes in PostgreSQL
57mUnderstanding Advanced Datatypes in PostgreSQL
55mMySQL 8.0: Not Only Good, it's GREAT
45mHibernate: Mapping Strategies and Their Database Performance Impact
52mBoosting Typical Query Patterns: PostgreSQL 18's Performance Enhancements
