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 3807852
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:03:23+00:00 2026-05-19T15:03:23+00:00

I am currently running a MySQL database. All of my tables are using the

  • 0

I am currently running a MySQL database. All of my tables are using the Table Engine InnoDB.

Everyone who logs into my application can view records and I am worried that at some point two users might update or insert a record at the same time. Does MySQL handle this type of concurrency issue gracefully, or is this something that I am going to have to program into my code?

If I do have to program it into my code how do you go about handling a concurrency case like this?

  • 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-05-19T15:03:24+00:00Added an answer on May 19, 2026 at 3:03 pm

    SQL statements are atomic. That is, if you execute something like this:

    UPDATE Cars SET Sold = Sold + 1
    

    Nobody can change the Sold variable during this statement. It is always incremented by 1, even if somebody else is executing the same statement concurrently.

    The problem occurs if you have statements that depend on each other:

    a = SELECT Sold FROM Cars;
    UPDATE Cars SET Sold = a + 1;
    

    Between these queries, another user can change the table Cars and update Sold. To prevent this, wrap it in a transaction:

    BEGIN;
    a = SELECT Sold FROM Cars;
    UPDATE Cars SET Sold = a + 1;
    COMMIT;
    

    Transactions are supported by InnoDB, but not by MyISAM.

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

Sidebar

Related Questions

I am currently running the following SQL statement on my MySQL database: INSERT INTO
I have A MySQL database currently in production use for a CakePHP application A
I have a mysql database that is currently running very slow. There are a
Currently I'm running a MySQL query like this $query = SELECT t1.id AS 'post_id',
I am currently running into an issue trying to create delegates from MethodInfo .
I'm currently running into trouble configuring MAMP 2 to use SSL with multiple virtual
I am currently running a PHP script that queries the database and then sends
My MySql server currently has 235 databases. Should I worry? They all have same
I currently have a table listing all of the products that are in the
I am creating a C++ application the uses a MySQL database. I would like

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.