Database transaction differences: can be committed read and read-repeat differences

Source: Internet
Author: User

This article comes from your own blog: http://www.wangerbao.com/?p=279


MySQL default thing is repeat read (REPEATABLE read isolation level),
Postgres default things are read Committed isolation level, and now compare their differences according to the instance.

Mysql:

Left for thing 1, right for thing 2.

The first step:

Things 1 queries, things 2 queries, and their query results are consistent.

650) this.width=650; "src=" Http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152812_22969.png "style=" Border:none;vertical-align:middle;height:auto; "/>

Step Two:

Things 1 Update-query-but do not commit, things 2 query, their results inconsistent

650) this.width=650; "Src=" http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152821_59754.png "Style=" Border:none;vertical-align:middle;height:auto; "/>

Step Three:

Things 1 commits-queries, things 2 queries, their results are inconsistent ——— actually the difference between the 2 things is here.


650) this.width=650; "src=" Http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152833_51660.png "style=" Border:none;vertical-align:middle;height:auto; "/>

Fourth Step:

Things 1 queries, things 2 commits-queries, their results are consistent
650) this.width=650; "src=" Http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152845_84863.png "style=" Border:none;vertical-align:middle;height:auto; "/>

Postgresql:

Left for thing 1, right for thing 2

The first step:

Things 1 query, things 2 query, query results are consistent.

650) this.width=650; "Src=" http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152859_80131.png "Style=" Border:none;vertical-align:middle;height:auto; "/>

Step Two:

Things 1 Modification-queries, things 2 queries, inconsistent query results

650) this.width=650; "Src=" http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152922_18522.png "Style=" Border:none;vertical-align:middle;height:auto; "/>

Step Three:

Thing 1 Commit-query, Thing 2 query, query results consistent


650) this.width=650; "src=" Http://www.wangerbao.com/wp-content/uploads/2015/11/20151105152935_63031.png "style=" Border:none;vertical-align:middle;height:auto; "/>
Fourth Step:

Things 1 Query, things 2 submit query, the result is consistent, no


This article is from the "www.wangerbao.com" blog, make sure to keep this source http://wangerbao.blog.51cto.com/4363165/1916026

Database transaction differences: can be committed read and read-repeat differences

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.