Skip to content
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

autoid, ddl: support changing AUTO_INCREMENT attribute to AUTO_RANDOM #19299

Closed
bb7133 opened this issue Aug 19, 2020 · 0 comments · Fixed by #20512
Closed

autoid, ddl: support changing AUTO_INCREMENT attribute to AUTO_RANDOM #19299

bb7133 opened this issue Aug 19, 2020 · 0 comments · Fixed by #20512
Assignees
Labels
feature/accepted This feature request is accepted by product managers type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@bb7133
Copy link
Member

bb7133 commented Aug 19, 2020

Feature Request

Is your feature request related to a problem? Please describe:
For now, column attribute AUTO_RANDOM is provided by TiDB as a better solution for unique ID allocations.

However, there may be a case where the users have tables that are currently using auto_increment, but the insert volume grows high enough that it becomes a bottleneck in the future.

Describe the feature you'd like:
Allow modifying existing AUTO_INCREMENT columns to AUTO_RANDOM.

Describe alternatives you've considered:
One possible alternative is that, users can create an empty table with the same schema, except that changing AUTO_INCREMENT to AUTO_RANDOM for the newly created table, and then "copy" all data into the new table.

However, this is not easy to use obviously.

Teachability, Documentation, Adoption, Migration Strategy:
Technically this is possible if the AUTO_INCREMENT doesn't consume too much allocation space yet(which should be most of the case).

AUTO_RANDOM can be simply treated as AUTO_INCREMENT with an extra SHARDING part:

| SignPart | ShardingPart | IncrementalPart |

In which the 'SignPart' and 'IncrementalPart' is actually the same with AUTO_INCREMENT, if we treat 'ShardingPart' as all zero for all allocated values for AUTO_INCRMENT column, it can be altered into AUTO_RANDOM attribute.

@bb7133 bb7133 added the type/feature-request Categorizes issue or PR as related to a new feature. label Aug 19, 2020
@zz-jason zz-jason added the feature/reviewing This feature request is reviewing by product managers label Aug 28, 2020
@zz-jason zz-jason added feature/accepted This feature request is accepted by product managers and removed feature/reviewing This feature request is reviewing by product managers labels Sep 29, 2020
@tangenta tangenta self-assigned this Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/accepted This feature request is accepted by product managers type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants