Schema and performance
Primary keys and AUTO_INCREMENT
Give each row a stable identifier and let MySQL allocate ordinary numeric identifiers when that fits the model.
8 minute lesson
~~~
A common primary key looks like this:
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
The value identifies a row inside the database. Do not expose assumptions about consecutive identifiers to application behavior or authorization.
Lesson completed