Database Review ⑩

Source: Internet
Author: User

Database Review ⑩

June 19, 2016

13:40

Main Transactions Transaction

The concept of 1.Transaction Concept transactions

A transaction is a unit of program execution that accesses and possibly updates various data items.

A transaction is a unit of concurrency control and is a user-defined sequence of operations. These operations are either done or not, and are an inseparable unit of work. With transactions, SQL Server can bind a logically related set of operations so that the server maintains the integrity of the data.

2. Start and end of a transaction

A transaction usually begins with a BEGIN transaction and ends with a commit or rollback.

Commit represents the commit, which commits all operations of the transaction. Specifically, all updates to the database in a transaction are written back to the physical database on disk, and the transaction ends normally.

Rollback represents a rollback, in which a transaction fails to proceed while the transaction is running, and the system undoes all of the completed operations on the database in the transaction and rolls back to the state where the transaction started.

Characteristics of the 3.ACID properties transaction (ACID properties)

A: atomicity (atomicity)

Either all operations of the transaction is properly reflected in the database or none is

A transaction is a logical unit of work for a database, and all operations included in the transaction are either done or not.

B: Consistency (consistency)

Execution of a transaction in isolation preserves the consistency of the database.

The result of the transaction execution must be to change the database from one consistent state to another. Consistency is closely related to atomicity.

C: Isolation (Isolation)

Although multiple transactions may execute concurrently, each transaction must is unaware of other concurrently executing Transactions. Intermediate transaction results must is hidden from the other concurrently executed transactions.

Execution of one transaction cannot be disturbed by other transactions.

D: Persistent/permanent (durability)

After a transaction completes successfully, the changes it had made to the database persist, even if there is system fail Ures.

Once a transaction is committed, its changes to the data in the database should be permanent.

Status of the 4.Transaction State transaction

Status of active initialization

Partially committed state before the last statement is executed

Failed the status of normal operation cannot continue processing

Aborted the transaction is rolled back, the data stored in the database is rolled back to its most primitive state.

Committed state after successful completion of the transaction

5. Concurrent operation of Concurrent executions transactions

Multiple transactions is allowed to run concurrently in the system. Advantages is:

Increased processor and disk utilization

Reduced average response time

Multiple transactions allow simultaneous operation under one system, with the following advantages:

Increase processor and disk utilization

Reduced average response time

6.Schedule Dispatch table/Progress meter

Schedule–a sequences of instructions that specify the chronological order in which instructions of concurrent transactio NS is executed

A progress meter is a sequential set of instructions that clarifies the order in which the execution of instructions for concurrent transactions is scheduled concurrently.

The 7.Conflict serializability can be serialized

Verify that the scheduling method can be serialized:

Precedence Graph precursor diagram

Recoverable Schedules recoverable dispatch

Cascading rollbacks Cascade Rollback

Related Posts Link: http://www.cnblogs.com/zpfbuaa/p/5479733.html

Database Review ⑩

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.