Mysql Reference explains that phantom read cannot be produced because it utilize snapshot for consistent nonlocking read.(A consistent read means that InnoDB uses multi-versioning to present to a query a snapshot of the database at a point in time.
)
I understood that this means that any write-operation of other session can't violate current transaction's read.(If I use only 'select' query on my session. Note that for update
clause is out of question.)
I've tested this using several where
clauses such as 'where id=10', or 'where id>10', and checked any effect from write-operation of other session. The result was consistent as reference said above.
But, What if I have enormous data ? The "snapshot" can be huge as following, which might cause "Out of memory" issue although I query for only one row (e.g. id = 10)
So, My question is "In MySQL, how snapshot is implemented exactly to prevent any problem?(including OOM I said)"
p.s. the version of MySQL I'm using is 8.0