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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:04:40+00:00 2026-06-14T07:04:40+00:00

Let’s say I have two files file1.php and file2.php . file1.php has the following

  • 0

Let’s say I have two files file1.php and file2.php.

file1.php has the following queries:

-query 1
-query 2
-query 3

file2.php has the following queries:

-query 4
-query 5
-query 6

Let’s say one visitor runs the first script and another visitor runs the second one exactly at the same time.

My question is: does MySQL receive one connection and keep the second connection in queue while executing all queries of the first script, and then moves on to the second connection?

Will the order of queries processed by MySQL be 1,2,3,4,5,6 (or 4,5,6,1,2,3) or can it be in any order?

What can I do to make sure MySQL executes all queries of one connection before moving on to another connection?

I’m concerned with data integrity. For example, account balance by two users who share the same account. They might see the same value, but if they both send queries at the same time, this could lead to some unexpected outcome

  • 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-14T07:04:42+00:00Added an answer on June 14, 2026 at 7:04 am

    The database can accept queries from multiple connections in parallel. It can execute the queries in arbitrary order, even at the same time. The isolation level defines how much the parallel execution may affect the results:

    If you don’t use transactions, the queries can be executed in parallel, and the strongest isolation level still guarantees only that the queries will return the same result as if they were not executed in parallel, but can still be run in any order (as long as they’re sorted within each connection)

    If you use transactions, the database can guarantee more:

    The strongest isolation level is serializable, which means the results will be as if no two transactions ran in parallel, but the performance will suffer.

    The weakest isolation level is the same as not using transactions at all; anything could happen.

    If you want to ensure data consistency, use transactions:

    START TRANSACTION;
    ...
    COMMIT;
    

    The default isolation level is read-commited, which is roughly equivalent to serializable with ordinary SELECTs happening out-of-transactions. If you use SELECT FOR UPDATE for every SELECT within the transaction, you get serializable

    See: http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read

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

Sidebar

Related Questions

Let's say I have two objects, Master and Slave . Slave has a method
Let's say I have the following two lists of tuples myList = [(1, 7),
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting
Let's say I don't have photoshop, but I want to make pattern files (.pat)
Let's say I have a C++ Visual Studio 2010 solution with 2 projects: one
Let's say I have the following object: var VariableName = { firstProperty: 1, secondProperty:
let's say I have the following string: string s = A B C D
Let's say I have the following entity: public class Store { public List<Product> Products
Let's say I have the following classes : public class MyProductCode { private String
Let's say I have two tables orgs and states orgs is (o_ID, state_abbr) and

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.