数据库写入测试
数据库写入测试 - free online developer tool. 100% client-side: your data never leaves your browser.
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.