Transactions

The user can use a set of SQL statements to control transactions. These statements allow us to explicitly start, commit, or rollback a transaction, but in some cases such operations are implicit. We can also set an isolation level, which determines which locks are acquired and how consistent the reads are. We can also declare in advance that a transaction is read only; this allows InnoDB to execute more internal optimizations.

The transactions life cycle

Usually, MariaDB transactions start with the START TRANSACTION statement and end with COMMIT or ROLLBACK. BEGIN WORK is a synonym for START TRANSACTION, but it does not work within stored programs, because the BEGIN and END keywords are used to enclose code blocks. The general syntax ...

Get Mastering MariaDB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.