Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: AUTO_RANDOM 生成的值是全局唯一ID还是根据表级别唯一
When designing a table with a primary key set as bigint with AUTO_RANDOM, if multiple tables in a database have this setting, are the generated IDs unique at the table level or globally unique?
It is definitely table-level uniqueness. I suggest not using auto-increment; random is fine.
The image you provided is not visible. Please provide the text you need translated.
Globally unique, referencing the Snowflake algorithm,
Special optimizations have been made to address region hotspot issues, with high bits flipped. The number of high bits flipped can be chosen and is related to sharding. 
I don’t know what you mean by “global.” In a table, all TiDB nodes are globally unique. If the title refers to the entire cluster, then definitely not.
This global refers to the globally unique identifier for all TiDB servers for a single table.
I personally understand it as a cluster.
The globally unique column value mentioned in the AUTO_RANDOM official documentation should be for the table, meaning it is globally unique at the table level. Otherwise, if I insert a piece of data and have to consider other tables, wouldn’t that be quite ridiculous?
Explicit insertion requires setting the system parameter allow_auto_random_explicit_insert
, which can be proven by the following: