DB Insert Benchmark
Compare IndexedDB insert speed for time-ordered IDs (ULID or UUID v7) versus random UUID v4 in your browser. Local measurement only, not a published lab result.
- What it does
- Compares IndexedDB insert time for time-ordered IDs (ULID or UUID v7) and random UUID v4.
- When to use it
- You want a local measurement before choosing a primary-key style.
- Example
- Run it in the browser. The numbers come from that run, not from a published benchmark.
Database Index Insertion Benchmark
Compare database index writing performance between Sequential IDs (ULIDs / UUID v7) and Random IDs (UUID v4) using IndexedDB.
Time-Sorted Sequential IDs (ULID / UUID v7)
IdleUnsorted Random IDs (UUID v4)
IdleIndex Insertion Cost Curve
This graph plots transaction latency (ms) for consecutive database insert operations. Notice how random inserts trigger B-Tree page splits, causing latency spikes.
Why is there a performance difference?
Modern databases (such as IndexedDB, SQLite, PostgreSQL, and MySQL) store primary keys inside a B-Tree or B+Tree index structure. When you insert sequential IDs (ULIDs, UUID v7), new records are always appended to the right-most edge of the index, requiring zero re-balancing. In contrast, random IDs (UUID v4) must be inserted at arbitrary nodes, forcing the database to frequently split data pages, move physical sectors, and fragment the index, resulting in slow writes and high storage space overhead.