10. Oct 2020 |

MySQL autoincrement PK growing quickly

Primary key (PK) is skipping values for some reason. This was an issue I spent time solving until I discovered that auto increment column increases after insertion error occurs. To avoid duplicates on this website I set rule on MySQL side that if three colums match then don’t insert (give insertion error and continue). This way I had hundreds of insertion errors every hour and therefore PK was growing rapidly.