autoid, ddl: support changing AUTO_INCREMENT
attribute to AUTO_RANDOM
#19299
Labels
feature/accepted
This feature request is accepted by product managers
type/feature-request
Categorizes issue or PR as related to a new feature.
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 toAUTO_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
toAUTO_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 asAUTO_INCREMENT
with an extraSHARDING
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 forAUTO_INCRMENT
column, it can be altered intoAUTO_RANDOM
attribute.The text was updated successfully, but these errors were encountered: