-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Snowflake ID generation #17389
Comments
We can definitely extend sequences to support other type of sequence generator. I do not understand the need for sharding sequences. |
Well, sharding is for:
|
@DeathBorn I think on vitess/go/vt/vtgate/engine/insert_common.go Lines 87 to 99 in 998433c
It also sounds like you might want to use SnowFlake as a new vindex type as well so that it provides a
Am I missing or misunderstanding things? |
yeah,
If we could "pluginize" Vitess |
Feature Description
Request
We would like to add Snowflake ID generation feature to Vitess.
Here is a working example on v11 code base.
It can really integrate nicely just like Vitess Sequences
Snowflake ID
How to implement
machine_id
+chosen epoch
) in a table just like Sequences do.machine_id
using cross-shard TX, which is ok, because table is practically never written due to the fact that we don't need to store last generated ID - benefit of Snowflake algorithm. This will cover Reshard operation too.sequence
andtimestamp
, and returningSnowflake ID
select next N values from snow_table
timestamp
+sequence
+chosen epoch
N
required idsI would like some comments on this before working on contribution. Can I use the same Sequence primitive but return 3 values instead of one -
timestamp
+sequence
+chosen epoch
? This would makechosen epoch
configurable.Use Case(s)
Benefits:
public_id
withUUID/NanoID/ULID
requires complex app code changes, complex communication between service, take at least 2x more space - BIGINT is better hereThe text was updated successfully, but these errors were encountered: