MyBB Community Forums

Full Version: UIDs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone know how to not mess up or fix the UIDs when you delete a user? I have a few spammers and the forum isn't even open so all of the UIDs are now messed up which is usually fun to look at. Sad
Unfortunately, the way SQL auto-incrementing works doesn't fill in deleted values, it just adds on the the highest one.
Paul is correct, but depending on the circumstance you may be able to recover those uids.

Say you have 500 members. The last 10 members are spammers, which you delete, leaving 490 members left. MySQL will continue from the last known entry, including those that are deleted. They leave a mark behind to note that yes, there was a value here once. If you optimize the table, this will essentially 'recycle' those spaces to free up disk space and allow the system to continue from 490, so the next member who registers will be uid 491.

This, of course, won't work if you deleted members 87, 136, and 394. The system will always continue from the highest incremented number. I hope that explains it. Smile