MySQL-basic concepts,

Source: Internet
Author: User

MySQL-basic concepts,


I. Mysql logic architecture

Reference from high performance Mysql

Ii. Concurrency Control

 
  • Read/write locks: Read locks are shared and exclusive, blocking other write and read locks.
  • Lock granularity: Table lock and row-Level Lock

Iii. Transactions

 
  • Transactions (ACID properties): atomicity, consistency, isolation, and persistence
  • Isolation level

Read uncommittedUncommitted read

Modifications in the transaction, even if not committed, are visible to other transactions.

The transaction reads uncommitted data calledDirty read.

Read committedSubmit read

The transaction can only see the modifications that have been committed by other transactions.

The query results of this transaction before and after other transactions are committed may be inconsistentNon-repeated read.

Repeatable readRepeatable read-Mysql Default level

Ensure that the data read by the same transaction is consistent multiple times.

When a transaction reads a record in a certain range, another transaction inserts a record into the returned record. When the previous transaction reads the record againPhantom read.

SerializableSerializable

Enforces the serial execution of transactions.

  • A deadlock occurs when multiple transaction colleagues lock a resource.

After a deadlock, you can roll back one or all of the transactions to break the deadlock. during the design of the application, you can consider re-executing the rollback transaction.

  • Transaction Log

The modification of data is recorded in the transaction log and persistent, but the data itself is not written to the disk, the system crashes, and the data can be recovered when the storage engine is restarted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.