The perils of UUID primary keys in SQLite
Summary
The article analyzes the performance impact of using random UUIDs as primary keys in SQLite, comparing UUID4 against integer primary keys (ROWID) and examining WITHOUT ROWID tables. It presents baseline benchmarks for integer keys, then shows that UUID4 causes 2-12x slower inserts due to random ordering, and discusses a UUID7 alternative that is time-ordered and improves performance. It includes code samples and a conclusion with guidance.