Autoincrement support

Hi there,

Can anybody please suggest how I may use the auto-increment feature likewise of MySQL. SERIAL is not working as of my way it is generating the random integer but not in the series.

Can I get the values in SERIAL like 1,2,3,4,5 or let say 100,101,102,103,104 likewise in the series as compare the generating the random number what SERIAL is doing.

Many thanks.
Saten

Implementing SERIAL is difficult (expensive) in a distributed system.

See this doc for more information: https://www.cockroachlabs.com/docs/stable/serial.html

Note that even in MySQL, SERIAL can have gaps in the series (when an insert is run but not committed).

If this is a strong requirement in your application, you can have a secondary table that stores a single row that you update with each insert (as a subquery). This table will become contended and cause conflicts if many hosts insert at the same time though.

Note that sequences are under active development though. https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/20171102_sql_sequences.md