{"id":13880528,"url":"https://github.com/craigpastro/pg_uuidv7","last_synced_at":"2025-04-15T05:43:03.239Z","repository":{"id":177158326,"uuid":"659960141","full_name":"craigpastro/pg_uuidv7","owner":"craigpastro","description":"A Postgres extension to generate v7 UUIDs","archived":false,"fork":false,"pushed_at":"2025-04-13T00:37:42.000Z","size":101,"stargazers_count":41,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T05:42:55.014Z","etag":null,"topics":["postgres","postgres-extension","postgresql","rust","uuidv7"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/craigpastro.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-29T00:16:12.000Z","updated_at":"2025-04-13T00:36:31.000Z","dependencies_parsed_at":"2023-09-04T05:25:43.039Z","dependency_job_id":"41cae1be-d4cd-41c2-ac44-b33062513a5f","html_url":"https://github.com/craigpastro/pg_uuidv7","commit_stats":null,"previous_names":["craigpastro/pg_uuidv7","craigpastro/pguuidv7"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpastro%2Fpg_uuidv7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpastro%2Fpg_uuidv7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpastro%2Fpg_uuidv7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigpastro%2Fpg_uuidv7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigpastro","download_url":"https://codeload.github.com/craigpastro/pg_uuidv7/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016307,"owners_count":21198828,"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":["postgres","postgres-extension","postgresql","rust","uuidv7"],"created_at":"2024-08-06T08:03:07.526Z","updated_at":"2025-04-15T05:43:03.230Z","avatar_url":"https://github.com/craigpastro.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# pg_uuidv7\n\nThis is an experimental Postgres extension to generate v7 UUIDs. Created with\n[pgrx](https://github.com/tcdi/pgrx), it is a thin wrapper around the Rust\n[uuid](https://docs.rs/uuid/latest/uuid/) crate.\n\n## Usage\n\n```\npostgres=# CREATE EXTENSION pg_uuidv7;\nCREATE EXTENSION\n\npostgres=# SELECT uuid_generate_v7();\n           uuid_generate_v7           \n--------------------------------------\n 018c5732-17b3-7451-b61a-223e7ee65241\n(1 row)\n\npostgres=# SELECT uuid_v7_to_timestamptz('018c5732-17b3-7451-b61a-223e7ee65241');\n   uuid_v7_to_timestamptz   \n----------------------------\n 2023-12-10 20:45:49.875-08\n(1 row)\n```\n\n## Docker\n\nYou can spin up a Postgres container with the `pg_uuidv7` extension installed\nwith `docker compose up -d`. Once the DB is up, you can connect to it using the\nfollowing connection string:\n\n```\npostgres://postgres:password@localhost:28801/postgres\n```\n\n## Installation\n\nRequires [pgrx](https://github.com/pgcentralfoundation/pgrx). If you have `pgrx` installed then\n\n```\ncargo pgrx run pg17\n```\n\nshould drop you into a psql prompt:\n\n```\npsql (17.4)\nType \"help\" for help.\n\npg_uuidv7=# CREATE EXTENSION pg_uuidv7;\nCREATE EXTENSION\n```\n\n## Benchmark\n\nBenchmarks were run on my 2023 Apple MacBook Pro with an M2 Pro chip and 16GB of\nmemory.\n\nThe benchmark I ran was\n\n```console\n$ pgbench -c 8 -j 8 -t 200000 -f ${TEST}.sql\n```\n\nwhich I borrowed from\n[fboulnois/pg_uuidv7](https://github.com/fboulnois/pg_uuidv7/blob/main/BENCHMARKS.md).\n\nFrom the results below this extension is faster than the native\n`gen_random_uuid()` function.\n\n```\n-- SELECT gen_random_uuid();\nscaling factor: 1\nquery mode: simple\nnumber of clients: 8\nnumber of threads: 8\nmaximum number of tries: 1\nnumber of transactions per client: 200000\nnumber of transactions actually processed: 1600000/1600000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 0.103 ms\ninitial connection time = 11.973 ms\ntps = 77810.710080 (without initial connection time)\n```\n\n```\n-- SELECT uuid_generate_v7();\nscaling factor: 1\nquery mode: simple\nnumber of clients: 8\nnumber of threads: 8\nmaximum number of tries: 1\nnumber of transactions per client: 200000\nnumber of transactions actually processed: 1600000/1600000\nnumber of failed transactions: 0 (0.000%)\nlatency average = 0.088 ms\ninitial connection time = 11.978 ms\ntps = 90862.885067 (without initial connection time)\n```\n\n## See also\n\n- [fboulnois/pg_uuidv7](https://github.com/fboulnois/pg_uuidv7)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigpastro%2Fpg_uuidv7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigpastro%2Fpg_uuidv7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigpastro%2Fpg_uuidv7/lists"}