First, let's see a good document. This is not mysql related documentation, it is about postgreSQl, but it is one of the simpler and clearer documents I read on a transaction. You better understand the MySQl transaction after reading this link http://www.postgresql.org/docs/8.4/static/mvcc.html
When performing a transaction, 4 rules (ACID) apply:
- Atomicity: all or nothing (rollback)
- Coherence: coherent before, sequential after
- : ?
- : , ,
, , . . , phantom -reads . , Row, , , (, , ), . ...
, , , , ( while).
Edit: ------------
InnoDb , . , , , , .
MySQL 3 4 , PosgtreSQL ( postgreSQL 2 ). . , Dirty reads, Non-repeatable reads. -, , , LOCK (, ).
. MySQL, 5.0, , , 2, , "FOR UPDATE"!
, , 4- ( LOCK IN SHARE MODE ), , . , , .
, : http://www.postgresql.org/docs/8.4/static/transaction-iso.html#MVCC-SERIALIZABILITY
:
- , , INSIDE ( , BEGIN)
- , ( -)
- ( ), ( , MySQL)
- (LOCK IN SHARE MODE), , , ( , , )