Get the App
SLTechnology News&Howtos  ›  Database  › 

Three minutes to understand mysql transaction knowledge

Shulou Source: shulou.com Published: 2022-06-01 18:16:02 10月03日 Update

This article mainly gives you a brief talk about the knowledge of mysql affairs. You can look up the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic. I hope this article on the knowledge of mysql transactions can bring you some practical help.

Mysql transaction

Transaction: a set of atomic SQL queries, or a single unit of work

ACID Test:

A:atomicity, atomicity: all operations in the entire transaction are either performed successfully or all failed and rolled back.

C:consistency, consistency: a database always transitions from one consistency state to another

I:Isolation, isolation; actions made by one firm cannot be seen by others until they are submitted

D:durability: persistence. Once a transaction commits, its changes are permanently saved in the database.

Transaction:

Start transaction, START TRANSACTION

End the transaction:

1.COMMIT

2.ROLLBACK

Recommendation: display request and commit transactions instead of using the autocommit feature

Autocommit 0

3. Transactions support savepoint

SAVEPOINT identifier

ROLLBACK [WORK] TO [SAVEPOINT] identifier

RELEASE SAVEPOINT identifier

4. Transaction isolation level:

Show global variables like 'tx_%'

READ-UNCOMMITED (read uncommitted): you can read changes that have not been committed in another session

READ-COMMITED (read submission): the content submitted by the other party can not be read until another session is submitted.

REPEATABLE-READ (rereadable): another session can only read previous data before it commits itself, whether it commits or not.

SERIALIZABILE (serializable): if you do not submit it yourself, the modification of the corresponding data will be blocked.

Mysql transaction knowledge will first tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Tags: Transactions knowledge data consistency specialties content atoms each other databases states industries or isolation success expertise topics books firms functions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Technology vpn Redmi NVidia