-
auto increment
lets say i have lots of concurrent users clicking away and my dB table uses auto increment for each unique click as a way to create a new row for their input. <br>
if several people happen to click at the same time could auto increment jam and cause the whole dB to crash?
-
Every time you execute a query, the row is processed then. There is no time to wait. So the only potential time for overlap is during the actual query. This is MUCH smaller than the loading time for the page. Secondly, the processing time within MySQL for auto-increment will be a few milliseconds. That's such a tiny amount that the odds of anyone overlapping are low.
Now, if that actually happens and somehow they overlap, then I'm not sure what happens. However, I imagine that MySQL is a single process on the server and will put queries in a queue so that two are not executed at the same time. Someone must have thought of this or had that problem and they probably fixed it.
I would not worry about this. In fact, I don't think there is any way to fix it even if it is a problem.
Secondly, it's not a horrible disaster if the auto increment index is duplicated. It might be wrong, but it won't crash the database. It will just duplicate the number. That's not awful. The worst that will happen is that things will happen twice based on that ID. If you delete row with ID "4" and there are two of them, then you will delete 2 rows.
-
db transactions are queued, so what you're describing won't happen.
-
thank you for the response. its hard to test mySql boundaries like this and found it difficult to acquire answers through google searches.
since i dont have lots of experience with large data sets im trying to understand mySql's potential weakness.
-
Thanks for confirming that, traq.