Any size of INT
may be used for AUTO_INCREMENT
. UNSIGNED
is always appropriate.
Keep in mind that certain operations "burn" AUTO_INCREMENT
ids. This could lead to an unexpected gap. Examples: INSERT IGNORE
and REPLACE
. They may preallocate an id before realizing that it won't be needed. This is expected behavior and by design in the InnoDB engine and should not discourage their use.