What is a database transaction?

Source: Internet
Author: User
  • What is a transaction?
    A transaction is a whole that consists of one or more SQL statements, and if all statements execute successfully then the modification will take effect, if one SQL statement will sell +1, the next +1, and if the second fails, then sales will undo the +1 operation of the first SQL statement. The modification is added to the database only if all the statements in the transaction are executed successfully.
  • Features of the transaction:
    Atomic Nature
    Atomicity means that the firm has an operation or all succeeds, or all fails to roll back, so the operation of the transaction must be fully applied to the database if it succeeds, if the operation fails it will have any effect on the database.
    Consistency
    Consistency means that a transaction must transform a database from one consistent state to another, meaning that a transaction must be in a consistent state after execution.
    Take the transfer, assuming that user A and User B are altogether 5000, then no matter how the money between A and B two users together should be 5000, which is the consistency of the transaction.
    Isolation of
    Isolation is when multiple users access the database concurrently, such as when working with the same table, the database opens a transaction for each user and is not disturbed by other operations
    , the concurrent transactions are isolated from each other.
    Durability
    Persistence means that once a transaction is committed, changes to the data in the database are permanent.
    Mysql中支持事务的引擎在mysql中用的最多 的存储引擎有:INNODB , BDB ,MYISAM, MEMORY,其中 INNODB ,BDB 支持事务,其他的不支持事务。
  • What is a database transaction?

    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.