YMatrix
Quick Start
Simulate Time Series Scenarios
Standard Cluster Deployment
Data Modeling
Connecting to The database
Data Writing
Data Migration
Data Query
Scene Application Examples
Federal Query
Maintenance and Monitoring
Global Maintenance
Partition Maintenance
Backup and Restore
Cluster Expansion
Enable Mirroring
Resource Management
Security
Monitoring
Performance Tuning
Troubleshooting
Reference Guide
Tool Guide
Data Type
Storage Engine
Execution Engine
Stream Processing
DR (Disaster Recovery)
Configuration Parameters
Index
Extension
SQL Reference
FAQ
Start the transaction block.
BEGIN [WORK | TRANSACTION] [transaction_mode]
Where transaction_mode is:
ISOLATION LEVEL {READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE}
READ WRITE | READ ONLY
[ NOT ] DEFERRABLE
BEGIN starts the transaction block, i.e. all statements after the BEGIN command will be executed in a single transaction until an explicit COMMIT or ROLLBACK is given. By default (without BEGIN), the YMatrix database executes transactions in an automatic commit mode, i.e. each statement executes in its own transaction and implicitly executes the commit at the end of the statement (if the execution is successful, otherwise rollback).
In transaction blocks, statements execute faster because transaction startup/commit requires a lot of CPU and disk activity. Executing multiple statements in a transaction is also useful for ensuring consistency when making some related changes: Other sessions will not see the intermediate state, where not all related updates are completed.
If isolation level, read/write mode, or delayable mode is specified, the new transaction has those characteristics, just like executing SET TRANSACTION.
WORK
TRANSACTION
SERIALIZABLE
READ COMMITTED
READ UNCOMMITTED
START TRANSACTION has the same functionality as BEGIN.
Use COMMIT or ROLLBACK to terminate the transaction block.
If it is already in a transaction block, issuing a BEGIN will cause a warning message. Transaction status is not affected. To nest transactions in transaction blocks, use a savepoint (see SAVEPOINT).
To start a transaction block:
BEGIN;
To start a transaction block at a repeatable isolation level:
BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN is an YMatrix database language extension. It is equivalent to the SQL standard command START TRANSACTION.
DEFERRABLE transaction_mode is an extension of the YMatrix database language.
Incidentally, the BEGIN keyword is used for different purposes in embedded SQL. It is recommended that you pay attention to transactional semantics when migrating database applications.
COMMIT , ROLLBACK , START TRANSACTION , SAVEPOINT , SAVEPOINT