# AUTO_RANDOM Attribute
+ `AUTO_RANDOM``: is a field property that is used to automatically and randomly populate default column values to resolve hot spot issues
  + Only `BIGINT` data types are supported
  + It's a random generator based on shards
  + LAST_INSERT_ID(): Similar to AUTO_INCREMENT, it retrieves the value used for the last insert
+ All new tables start with one region, and all write requests will be sent to this region. Hotspots are caused.
+ You can pre-split the regions
```
CREATE TABLE test.ar (id BIGINT PRIMARY KEY AUTO_RANDOM, name BOOLEAN)
SPLIT TABLE test.ar BETWEEN (<lower_value>) AND (<upper_value>) REGIONS 16
```
------------------------------------------------------------------------------
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
