pass int64 1 3 | strategy stringclasses 3
values | what stringclasses 3
values | col stringclasses 3
values | type stringclasses 2
values | rows int64 3M 20M | batch int64 100k 250k | baseMs int64 1,756B 1,756B | order stringclasses 2
values | sizes dict | pgstatindex dict | lookup dict | settings listlengths 10 10 | measurements listlengths 30 80 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | R | random uuid, arriving in no order | k_r | uuid | 3,000,000 | 100,000 | 1,756,200,000,000 | R>T>B | {
"table": 446840832,
"index": 128106496,
"total": 575086592,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 128106496,
"root_block_no": 295,
"internal_pages": 87,
"leaf_pages": 15550,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 66.66,
"leaf_fragmentation": 49.82
} | {
"found": 2000,
"ms": 291.508
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 338.846,
"wal_bytes": 17691504,
"table_bytes": 14901248,
"index_bytes": 4554752,
"at": "2026-08-26T19:42:40.870708+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 347.325,
"wal_bytes": 17640344,
"table_b... |
1 | T | uuid v7, arriving strictly ascending | k_t | uuid | 3,000,000 | 100,000 | 1,756,200,000,000 | R>T>B | {
"table": 446840832,
"index": 94642176,
"total": 541622272,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 94642176,
"root_block_no": 295,
"internal_pages": 57,
"leaf_pages": 11495,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.03,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 431.526
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 287.59,
"wal_bytes": 16010912,
"table_bytes": 14901248,
"index_bytes": 3178496,
"at": "2026-08-26T19:43:31.943831+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 248.87,
"wal_bytes": 16016840,
"table_byt... |
1 | B | TSID bigint, 8 bytes, ascending | k_b | bigint | 3,000,000 | 100,000 | 1,756,200,000,000 | R>T>B | {
"table": 423731200,
"index": 67403776,
"total": 491266048,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 67403776,
"root_block_no": 412,
"internal_pages": 30,
"leaf_pages": 8197,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.09,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 622.381
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 264.388,
"wal_bytes": 14295816,
"table_bytes": 14131200,
"index_bytes": 2260992,
"at": "2026-08-26T19:44:16.519101+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 241.979,
"wal_bytes": 14638800,
"table_b... |
2 | B | TSID bigint, 8 bytes, ascending | k_b | bigint | 3,000,000 | 100,000 | 1,756,200,000,000 | B>T>R | {
"table": 423731200,
"index": 67403776,
"total": 491266048,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 67403776,
"root_block_no": 412,
"internal_pages": 30,
"leaf_pages": 8197,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.09,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 871.894
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 242.029,
"wal_bytes": 14290208,
"table_bytes": 14131200,
"index_bytes": 2260992,
"at": "2026-08-26T19:45:00.7978+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 255.232,
"wal_bytes": 17647888,
"table_byt... |
2 | T | uuid v7, arriving strictly ascending | k_t | uuid | 3,000,000 | 100,000 | 1,756,200,000,000 | B>T>R | {
"table": 446840832,
"index": 94642176,
"total": 541622272,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 94642176,
"root_block_no": 295,
"internal_pages": 57,
"leaf_pages": 11495,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.03,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 813.046
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 332.578,
"wal_bytes": 18183560,
"table_bytes": 14901248,
"index_bytes": 3178496,
"at": "2026-08-26T19:45:45.535032+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 241.758,
"wal_bytes": 16010432,
"table_b... |
2 | R | random uuid, arriving in no order | k_r | uuid | 3,000,000 | 100,000 | 1,756,200,000,000 | B>T>R | {
"table": 446840832,
"index": 128106496,
"total": 575086592,
"rows": 3000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 128106496,
"root_block_no": 295,
"internal_pages": 87,
"leaf_pages": 15550,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 66.66,
"leaf_fragmentation": 49.82
} | {
"found": 2000,
"ms": 568.91
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 100000,
"ms": 322.009,
"wal_bytes": 19883432,
"table_bytes": 14901248,
"index_bytes": 4554752,
"at": "2026-08-26T19:46:30.827099+00:00"
},
{
"batch": 2,
"lo": 100000,
"hi": 200000,
"ms": 345.547,
"wal_bytes": 18952040,
"table_b... |
3 | R | random uuid, arriving in no order | k_r | uuid | 20,000,000 | 250,000 | 1,756,200,000,000 | R>T>B | {
"table": 2978914304,
"index": 799064064,
"total": 3778789376,
"rows": 20000000
} | {
"version": 4,
"tree_level": 3,
"index_size": 799064064,
"root_block_no": 53190,
"internal_pages": 478,
"leaf_pages": 97063,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 71.17,
"leaf_fragmentation": 49.8
} | {
"found": 2000,
"ms": 411.303
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 250000,
"ms": 952.924,
"wal_bytes": 59497376,
"table_bytes": 37240832,
"index_bytes": 9977856,
"at": "2026-08-26T19:49:39.236195+00:00"
},
{
"batch": 2,
"lo": 250000,
"hi": 500000,
"ms": 959.975,
"wal_bytes": 56253568,
"table_b... |
3 | T | uuid v7, arriving strictly ascending | k_t | uuid | 20,000,000 | 250,000 | 1,756,200,000,000 | R>T>B | {
"table": 2978914304,
"index": 630857728,
"total": 3610533888,
"rows": 20000000
} | {
"version": 4,
"tree_level": 3,
"index_size": 630857728,
"root_block_no": 59747,
"internal_pages": 379,
"leaf_pages": 76629,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.04,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 525.804
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 250000,
"ms": 748.771,
"wal_bytes": 52610576,
"table_bytes": 37240832,
"index_bytes": 7905280,
"at": "2026-08-26T19:55:12.171725+00:00"
},
{
"batch": 2,
"lo": 250000,
"hi": 500000,
"ms": 675.498,
"wal_bytes": 52605976,
"table_b... |
3 | B | TSID bigint, 8 bytes, ascending | k_b | bigint | 20,000,000 | 250,000 | 1,756,200,000,000 | R>T>B | {
"table": 2824830976,
"index": 449241088,
"total": 3274792960,
"rows": 20000000
} | {
"version": 4,
"tree_level": 2,
"index_size": 449241088,
"root_block_no": 412,
"internal_pages": 193,
"leaf_pages": 54645,
"empty_pages": 0,
"deleted_pages": 0,
"avg_leaf_density": 90.09,
"leaf_fragmentation": 0
} | {
"found": 2000,
"ms": 544.45
} | [
{
"name": "checkpoint_timeout",
"setting": "1800",
"unit": "s"
},
{
"name": "fsync",
"setting": "on",
"unit": null
},
{
"name": "full_page_writes",
"setting": "on",
"unit": null
},
{
"name": "maintenance_work_mem",
"setting": "262144",
"unit": "kB"
},
... | [
{
"batch": 1,
"lo": 0,
"hi": 250000,
"ms": 681.165,
"wal_bytes": 51108344,
"table_bytes": 35315712,
"index_bytes": 5627904,
"at": "2026-08-26T19:59:10.11072+00:00"
},
{
"batch": 2,
"lo": 250000,
"hi": 500000,
"ms": 621.985,
"wal_bytes": 48306184,
"table_by... |
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
@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}
}
- Downloads last month
- -