Are you using InnoDB tables on MySQL version 5.1.22 or newer? If so, you probably have gaps in your auto-increment columns. A simple INSERT IGNORE query creates gaps for every ignored insert, but this is undocumented behavior. This documentation bug is already submitted. Firstly, we will start with a simple question. Why do we have gaps on auto-increment columns? Secondly, I will show you a trick