Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:58:38+00:00 2026-06-15T10:58:38+00:00

Does MVCC database isolation mode allow in-progress transactions to see rows inserted (and committed)

  • 0

Does MVCC database isolation mode allow in-progress transactions to see rows inserted (and committed) by other transactions?

For example, given:

  • Table names[id BIGINT NOT NULL, name VARCHAR(30), PRIMARY KEY(id), UNIQUE(name)]
  • Transactions T1 and T2,
T1: open transaction
T2: open transaction
T1: select * from names;
    insert into names(name) values("John");
    // do something
    commit;
T2: select * from names;
    insert into names values("John");
    // do something
    commit;

When does T2 first become aware of the new row? At select time? At insert time? Or at commit time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:58:39+00:00Added an answer on June 15, 2026 at 10:58 am

    Answer really depends on server implementation and whether unique constraint is marked deferrable or not.

    I have not tested it for other databases, but in PostgreSQL (as one of most prominent open-source MVCC databases) in my test replicating your setup T2 fails on INSERT. However, T2 cannot see any changes made by T1 by using SELECT.

    I have executed following statements almost at the same time in 2 separate SQL connections:

    BEGIN;
    SELECT * FROM names;
    SELECT pg_sleep(10);
    INSERT INTO names values('john');
    SELECT pg_sleep(10);
    COMMIT;
    

    One succeeded, but another failed after 10 seconds with:

    ERROR:  duplicate key value violates unique constraint "names_pkey"
    DETAIL:  Key (name)=(john) already exists.
    

    This makes sense, because documentation says:

    If a conflicting row has been inserted by an as-yet-uncommitted
    transaction, the would-be inserter must wait to see if that
    transaction commits. If it rolls back then there is no conflict. If it
    commits without deleting the conflicting row again, there is a
    uniqueness violation.

    If, however, unique constraint was marked deferrable, uniqueness will be checked at COMMIT time:

    If the unique constraint is deferrable, there is additional
    complexity: we need to be able to insert an index entry for a new row,
    but defer any uniqueness-violation error until end of statement or
    even later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does jQuery 1.5.1 support attribute selectors in the closest method? Given the structure below,
Does the Swing API have classes which combine InputVerifiers? For example, I have three
Does anyone have a really good example where there are two tables with a
Does Monodevelop allow .net assemblies to be debugged that have been built using Visual
Does anyone know how to change the iPhone settings for an app? For example
When an example of an object owning many children is given with a document
Does anyone have a working, step-by-step example of how to implement IEnumerable and IEnumerator
Does anyone know if there is a way to generate different code in the
Does COUNT(*) have any significant impact for MySQL performance if query already has GROUP
Does anyone have a translate function for x/y positions after rotation in javascript? for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.