Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb 从 AUTO_INCREMENT 修改为 auto_random 是否锁表
[TiDB Usage Environment] prod
[TiDB Version] v5.0
Issue:
Table size: 200 million+
Daily operations: frequent curl, every second
Operation: Change from AUTO_INCREMENT to auto_random
Using alter
Operation target: primary key
Issue: 1. Is it a heavy operation (table lock + long duration)?
Why not find a test environment to try it out and share the test results with everyone?
The test environment doesn’t have that much data, and preparing the data is time-consuming.
Do it yourself and give it a try~
The official documentation doesn’t mention it either; there might be a metadata lock.
Isn’t it that modifying or adding the auto_random attribute is not supported?
The new version is supported. Check out the new version’s documentation. I was also informed by community members.
I learned something new. I checked the documentation and found that auto_increment was only supported to be changed to auto_random starting from version V5.4. If the original poster is using version V5.0, this operation is not supported yet.
It is recommended to test it. The test data table can have only a few fields, including the primary key and 2 or 3 others.
You can’t change it in 5.0, right?
It seems that locks are related to versions, right?