Aman Garg
Jul 18, 2020

--

Besides the problems of auto increment columns that you have stated, there are also few other real problems.

- IDs are placed in browser cookies. One can inspect local storage and generate +/- N versions of the ID to get IDs for other users. Using UUID makes it hard to guess.

- A MySQL table cannot be sharded across multiple instances when columns are auto increment. This has a huge impact. One of our tables containing over 20M auto incremented rows is pretty hard to shard now. Although Vitess sequences offer an alternative, one should stay away from auto increment values if they ever plan to shard their table.

--

--