{"id":16002380,"url":"https://github.com/iCyberon/pg_xid","last_synced_at":"2025-10-21T07:31:20.252Z","repository":{"id":51197633,"uuid":"115955549","full_name":"iCyberon/pg_xid","owner":"iCyberon","description":"pg_xid is a globally unique id generator thought for the web","archived":false,"fork":false,"pushed_at":"2021-05-20T10:13:39.000Z","size":6,"stargazers_count":32,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-04T03:58:27.105Z","etag":null,"topics":["postgresql","postgresql-extension","unique-id","unique-identifier","xid"],"latest_commit_sha":null,"homepage":null,"language":"C","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/iCyberon.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}},"created_at":"2018-01-01T23:27:14.000Z","updated_at":"2025-02-01T23:39:51.000Z","dependencies_parsed_at":"2022-09-03T13:30:31.293Z","dependency_job_id":null,"html_url":"https://github.com/iCyberon/pg_xid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCyberon%2Fpg_xid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCyberon%2Fpg_xid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCyberon%2Fpg_xid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iCyberon%2Fpg_xid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iCyberon","download_url":"https://codeload.github.com/iCyberon/pg_xid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237448887,"owners_count":19311748,"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":["postgresql","postgresql-extension","unique-id","unique-identifier","xid"],"created_at":"2024-10-08T10:01:37.721Z","updated_at":"2025-10-21T07:31:14.976Z","avatar_url":"https://github.com/iCyberon.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# pg_xid - globally Unique ID Generator for PostgreSQL\n\npg_xid is a globally unique ID generator extension for PostgreSQL.\n\nIt is using Mongo Object ID algorithm to generate globally unique ids:\nhttps://docs.mongodb.org/manual/reference/object-id/\n\n- 4-byte value representing the seconds since the Unix epoch,\n- 3-byte machine identifier,\n- 2-byte process id, and\n- 3-byte counter, starting with a random value.\n\nThe binary representation of the id is compatible with Mongo 12 bytes Object IDs.\n\nUUIDs are 16 bytes (128 bits) and 36 chars as string representation. Twitter Snowflake\nids are 8 bytes (64 bits) but require machine/data-center configuration and/or central\ngenerator servers. xid stands in between with 12 bytes (96 bits). No configuration or central generator server\nis required so it can be used directly.\n\n| Name        | Binary Size | Features\n|-------------|-------------|----------------\n| [UUID]      | 16 bytes    | configuration free, not sortable\n| [shortuuid] | 16 bytes    | configuration free, not sortable\n| [Snowflake] | 8 bytes     | needs machin/DC configuration, needs central server, sortable\n| [MongoID]   | 12 bytes    | configuration free, sortable\n| xid         | 12 bytes    | configuration free, sortable\n\n[UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier\n[shortuuid]: https://github.com/stochastic-technologies/shortuuid\n[Snowflake]: https://blog.twitter.com/2010/announcing-snowflake\n[MongoID]: https://docs.mongodb.org/manual/reference/object-id/\n\nFeatures:\n\n- Size: 12 bytes (96 bits), smaller than UUID, larger than snowflake\n- Non configured, you don't need set a unique machine and/or data center id\n- K-ordered\n- Embedded time with 1 second precision\n- Unicity guaranteed for 16,777,216 (24 bits) unique ids per second and per host/process\n- Lock-free (i.e.: unlike UUIDv1 and v2)\n\nReferences:\n\n- https://github.com/rs/xid\n- http://www.slideshare.net/davegardnerisme/unique-id-generation-in-distributed-systems\n- https://en.wikipedia.org/wiki/Universally_unique_identifier\n- https://blog.twitter.com/2010/announcing-snowflake\n- Python port by [Graham Abbott](https://github.com/graham): https://github.com/graham/python_xid\n\nInspired by [Olivier Poitrey](https://github.com/rs)'s Xid.\n\n## Build\n\n    make\n    make install\n    \n## Install\n\n     CREATE EXTENSION pg_xid;\n\n## Usage\n\n```SQL\nSELECT xid(); -- returns: BYTEA\n\nSELECT encode(xid(),'hex'); -- returns: TEXT\n```\n\n## Licenses\n\nAll source code is licensed under the [MIT License](https://raw.github.com/icyberon/pg_xid/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiCyberon%2Fpg_xid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FiCyberon%2Fpg_xid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiCyberon%2Fpg_xid/lists"}