I've got some experience using PHP and MySQL, and I know about Transactions but have fairly little experience using them.
I am developing a web application where users will be making/doing various CRUD operations on/to a single DB. (Yes it's InnoDB). And I'm curious as to how transactions will behave, I'll give you a fairly trivial example:
1.) User 1 begins a transaction to update the name of John Smith
in my DB to Johnathon Smith
.
2.) User 2 begins a transaction to read the name of John Smith
right after User 1's transaction has begun, but before it has COMMITTED.
What will User 2 see as the result? John
or Johnathon
?
During User 1's transaction, is the record of John Smith
locked, or can it be read during the transaction?
Also, how does the timing work with these two transactions? Does the transaction of User 2, sit around in some queue and wait until User 1's transaction has completely finished? How does the MySQL DB triage multiple transactions trying to access the same table/record?
Another also, let's say that the operations of User 1's transaction on average take 500 ms to complete, and the operations of User 2's transaction takes on average 750 ms to complete. How long of response time will User 2 have? 1250 ms?
Any links to relevant articles or other SO questions are greatly appreciated!