cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.86k stars 3.77k forks source link

builtins: consider adding xid-based generator #37031

Open roncrdb opened 5 years ago

roncrdb commented 5 years ago

A user on the forum recently requested considering using xid as a way to generate unique Ids.

You can find more info about xid here.

Jira issue: CRDB-4461

github-actions[bot] commented 2 years ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!

nicolasparada commented 2 years ago

Any update on this?

nicolasparada commented 1 year ago

With the new UDF I thought it would be possible to do something like this https://github.com/modfin/pg-xid

But sadly it is missing a few pieces:

Machine ID

SELECT system_identifier & 16777215 FROM pg_control_system();

Doesn't seem to work to retrieve the machine ID.

Process ID

pg_backend_pid()

Works, but it's not the real process ID.