| Metadata | Value |
|---|---|
| Status | Accepted |
| Version | 1.0.0 |
| Last Updated | 2026-09-10 |
| Author | Sangeetha Grantha Team |
| Document Type | Decision record |
[!NOTE] Decision record: preserve the original rationale and check its decision/supersession status. Current runtime guidance is in system architecture and Flyway migrations.
The platform was running PostgreSQL 15 since inception. Two drivers motivated an upgrade:
uuidv7() function, improved query planning, and better JSON performance.gen_random_uuid()) cause B-tree index fragmentation and provide no temporal ordering. For a growing dataset of compositions, temporally-ordered IDs improve index locality and enable implicit chronological sorting.TRACK-072 tracked the upgrade work (February 2026).
Upgrade from PostgreSQL 15 to PostgreSQL 18.3 and adopt UUID v7 as the default primary key generation strategy for all tables.
postgres:18.3-alpinegen_random_uuid() to uuidv7() default values37__uuid-v7-adoption.sql) performed the conversionuuidv7() as a built-in function — no extensions required.-- For each of 27 tables:
ALTER TABLE composers ALTER COLUMN id SET DEFAULT uuidv7();
ALTER TABLE ragas ALTER COLUMN id SET DEFAULT uuidv7();
-- ... (all domain and infrastructure tables)
services:
db:
image: postgres:18.3-alpine
No changes required — Exposed’s uuid() column type works identically with v4 and v7 UUIDs:
object ComposersTable : Table("composers") {
val id = uuid("id").autoGenerate() // Works with uuidv7() default
}