{"id":15589599,"url":"https://github.com/sokil/id-bench","last_synced_at":"2026-04-12T04:33:34.391Z","repository":{"id":152458188,"uuid":"618349796","full_name":"sokil/id-bench","owner":"sokil","description":"Database identifier benchmarks","archived":false,"fork":false,"pushed_at":"2023-07-28T08:43:52.000Z","size":2866,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T00:43:33.564Z","etag":null,"topics":["autoincrement","b-tree","benchmarking","mariadb","mongodb","mysql","percona","performance-analysis","postgresql","uuid","uuid7"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sokil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-24T09:27:13.000Z","updated_at":"2024-05-22T18:41:33.000Z","dependencies_parsed_at":"2023-08-18T03:01:34.640Z","dependency_job_id":null,"html_url":"https://github.com/sokil/id-bench","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"5374792fb8b5e9c68d26114e9722d72ffd19408d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fid-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fid-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fid-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2Fid-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sokil","download_url":"https://codeload.github.com/sokil/id-bench/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246168097,"owners_count":20734389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoincrement","b-tree","benchmarking","mariadb","mongodb","mysql","percona","performance-analysis","postgresql","uuid","uuid7"],"created_at":"2024-10-02T23:03:11.131Z","updated_at":"2025-12-30T23:18:48.731Z","avatar_url":"https://github.com/sokil.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# id-bench\n\nPrimary key and secondary key insertion and selection benchmarking\n\n## 1. UUID Versions \n\n| Version | Description                                                                                                                                                                                                                                                                                                                                                                        |\n|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1       | The time-based version.                                                                                                                                                                                                                                                                                                                                                            |\n| 2       | DCE Security version, with embedded POSIX UIDs.                                                                                                                                                                                                                                                                                                                                    |\n| 3       | The name-based version that uses MD5 hashing. Implementations SHOULD utilize UUID version 5 if possible.                                                                                                                                                                                                                                                                           |\n| 4       | The randomly or pseudo-randomly generated version.                                                                                                                                                                                                                                                                                                                                 |\n| 5       | The name-based version that uses SHA-1 hashing                                                                                                                                                                                                                                                                                                                                     |\n| 6       | UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality. It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs. Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead.                                                                                                       |\n| 7       | UUID version 7 features a time-ordered value field derived from the widely implemented and well known Unix Epoch timestamp source, the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded. As well as improved entropy characteristics over versions 1 or 6. Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible. |\n| 8       | RFC-compatible format for experimental or vendor-specific use cases.                                                                                                                                                                                                                                                                                                               |\n\n## 2. Test environment definition\n\nCPU: 12th Gen Intel(R) Core(TM) i7-1255U\nRAM: 16 GB\n\n### 2.1. Database schemas\n\n* [MySQL](docker/mysql_8_0/initdb/schema.sql)\n* [Postgres](docker/postgres_15_2/initdb/schema.sql)\n\n### 2.2. Running tests\n\nRun next command with defined parameters:\n\n```\ndocker compose run --rm php ./bin/bench [database] [benchmark] -b [batch-size] -i [iterations]\n```\n\n### 2.3 Building charts\n\nAfter running benchmarks, you may build charts:\n\n```\n./bin/plot.sh\n```\n\n## 3. Results\n\n### 3.1. Insert To Primary Key\n\nRecords inserted by batch 5000 times with size 2000. Total amount of records - 10kk.\n\n* [MySQL 8.0 InnoDb](#mysql-80-innodb-with-promary-key)\n* [Percona 8.0 InnoDb](#percona-80-innodb-with-promary-key)\n* [MariaDB 10.11 InnoDb](#mariadb-1011-innodb-with-promary-key)\n* [Postgres 15.2](#postgres-152-with-promary-key)\n* [MongoDB 6.0](#mongodb-60-with-promary-key)\n\n#### MySQL 8.0 InnoDb with promary key\n\n![Insert time](results/mysql-insertPrimary-time.png)\n![Insert time](results/mysql-insertPrimary-indexsize.png)\n\n#### Percona 8.0 InnoDb with promary key\n\n![Insert time](results/percona-insertPrimary-time.png)\n![Insert time](results/percona-insertPrimary-indexsize.png)\n\n#### MariaDB 10.11 InnoDb with promary key\n\n![Insert time](results/mariadb-insertPrimary-time.png)\n![Insert time](results/mariadb-insertPrimary-indexsize.png)\n\n#### Postgres 15.2 with promary key\n\n![Insert time](results/postgres-insertPrimary-time.png)\n![Insert time](results/postgres-insertPrimary-indexsize.png)\n\n#### MongoDB 6.0 with promary key\n\nMongoDb has no auto increment feature, so external sequence used and MongoDB just insert integers.\n\n![Insert time](results/mongodb-insertPrimary-time.png)\n![Insert time](results/mongodb-insertPrimary-indexsize.png)\n\n### 3.2. Insert To Secondary Index\n\nRecords inserted by batch 5000 times with size 2000. Total amount of records - 10kk.\n\n#### MySQL 8.0 InnoDb  with secondary key\n\n![Insert time](results/mysql-insertSecondary-time.png)\n![Insert time](results/mysql-insertSecondary-indexsize.png)\n\n## 4. Materials\n\n* https://www.percona.com/blog/uuids-are-popular-but-bad-for-performance-lets-discuss/\n* https://www.ietf.org/rfc/rfc4122.txt\n* https://uuid6.github.io/uuid6-ietf-draft/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fid-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsokil%2Fid-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fid-bench/lists"}