--- license: mit language: - en pretty_name: key-order size_categories: - n<1K tags: - postgres - database - benchmark - uuid - btree configs: - config_name: measurements data_files: - split: train path: out/measurements-pass*.jsonl - config_name: reads data_files: - split: train path: out/reads-pass*.jsonl - config_name: measurements_docker data_files: - split: train path: out-docker/measurements-pass*.jsonl --- # key-order Author: Dmitriy Semenkevich (dimhold) This dataset is an independent replication of the cost of a random UUID primary key against ordered keys on Postgres: 3 key strategies (random uuid, uuid v7, bigint TSID) inserted into identical tables, with every batch timing and buffer counter. Headline, from the repository: after three million rows the index on random keys has 49.8% leaf fragmentation and 66.7% leaf density, while the index on time ordered keys has 0% fragmentation and 90% density, on identical data. Reads cost the same: a point lookup answered in 236 us cold on both indexes. This is a mirror. The canonical home is the Zenodo record and the GitHub repository; criteria, limitations and full tables live there. - Paper: https://dimhold.by/papers/key-order/ - Code and full write up: https://github.com/dimhold/key-order - DOI: https://doi.org/10.5281/zenodo.22128828 ## Files | path | what it is | |---|---| | `out/measurements-pass*.jsonl` | insert passes: per strategy sizes, `pgstatindex`, batch timings, settings | | `out/reads-pass*.jsonl` | cold and warm point lookups with buffer counters | | `out-docker/measurements-pass*.jsonl` | the same insert passes in Docker | Files ending in `.jsonl` here are `.ndjson` in the GitHub repository, renamed so the viewer reads them; the content is unchanged. ## How it was produced Keys are generated deterministically ahead of time into a source table identical for every strategy, `fsync` stays on and the strategy order alternates between passes. The disproof threshold was fixed before counting (`CRITERIA.md` in the repository). No model was involved. The scripts that turn these files into every number are in the GitHub repository. ## Licence MIT, the licence of the repository, covering code and data. ## Citation ```bibtex @misc{semenkevich2026keyorder, author = {Semenkevich, Dmitriy}, title = {key-order: what a random primary key costs on Postgres, an independent replication}, year = {2026}, doi = {10.5281/zenodo.22128828}, url = {https://doi.org/10.5281/zenodo.22128828} } ```