# AUTO_RANDOM Attribute - cont'd
+ The value of AUTO_RANDOM is random and unique
+ Best practice: S = log (2, x)
  + S - Shard bits
  + x - Number of TiKV nodes 
+ Shard bits can be increased, but not decreased

![`smart`](AutoRandomValueStructure_aa_001_20240125.png)

------------------------------------------------------------------------------
Class demo scripts:

https://github.com/pingcap/tidb-course-201-lab/blob/master/scripts/07-demo-auto-random-01-show.sql

Note: Please try the following script to see the details.


drop table if exists test.ar;

drop table if exists test.dummy;

create table test.ar (id bigint primary key auto_random, name boolean);

insert into test.ar (name) values (null);

insert into test.ar (name) values (null);

select last_insert_id();

select distinct substr(id,1,14) from test.ar; 

select * from information_schema.tables where table_name='ar' and table_schema='test'\G


