START TRANSACTION ... WITH CONSISTENT SNAPSHOT
Learn how to start a consistent transaction for backups or replication setup. This command ensures a consistent view of the database without locking tables unnecessarily.
Syntax
START TRANSACTION [transaction_characteristic [, transaction_characteristic] ...]
transaction_characteristic:
WITH CONSISTENT SNAPSHOT
| READ WRITE | READ ONLY
| [NOT] CHAINThe InnoDB Read View
Transaction Type
Creation of Read View
Time of Read View Creation
Behavior with Transaction Isolation Levels
Isolation Level
Default Read View Behavior
Effect of WITH CONSISTENT SNAPSHOT
With Default Read View Behavior
Checking an Account Balance with a Transaction Delay
Setup
Scenario: Two sessions are running concurrently.
Timeline
Session 1 (Application checking balance)
Session 2 (An external deposit)
With CONSISTENT SNAPSHOT
Timeline
Session 1 (Application checking balance)
Session 2 (An external deposit)
Related System Variables
innodb_snapshot_isolation
innodb_snapshot_isolationPreviousReplication When the Primary and Replica Have Different Table DefinitionsNextRestricting Speed of Reading Binlog from Primary by a Replica
Last updated
Was this helpful?

