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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:02:39+00:00 2026-06-10T01:02:39+00:00

I have done extensive research about MySQL transactions via the PHP PDO interface. I

  • 0

I have done extensive research about MySQL transactions via the PHP PDO interface. I am still a little fuzzy about the actual background workings of the transaction methods. Specifically, I need to know if there is any reason that I should want to prevent all my queries (SELECTs included) inside a transaction spanning from the beginning of the script to the end? Of course, handling any error in the transaction and rolling them back if need be.

I want to know if there is any locking going on during a transaction and if so, is it row level locking because it is InnoDB?

  • 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-10T01:02:41+00:00Added an answer on June 10, 2026 at 1:02 am

    Don’t do that.

    The reason for this is that transactions take advantage of MVCC a mechanism by which every piece of data updated is in fact not update-in-place but merely inserted in somewhere else.

    MVCC implies allocating memory and or storage space to accumulate and operate all of the changes you send it without committing them to disk until you issue a COMMIT.

    That means that while your entire script runs all changes are stored until the script ends. And all of the records that you try and change during the transaction are marked as “work in progress” so that other processes/threads can know that this data will soon be invalidated.

    Having certain pieces of data marked as “work in progress” for the entire length of the script means that any other concurrent update will see the flag and say “i have to wait until this finishes so I’ll get the most recent data”.

    This includes SELECTS depending on isolation levels. Selecting stuff that is marked as “work in progress” may not be what you want because some tables that you may want to join may contain already updated data while other tables are not updated yet resulting in a dirty read.

    Transactionality and atomicity of operations is desirable but costly. Use it where it’s needed. Yes that means more work for you to figure out where race conditions can happen and even if race conditions occur you have to make the decision if they are really critical or is “some” data loss/mix acceptable.

    Would you like your logs and visit counters and other statistics to drag down the speed of your entire site? Or is the quality of that information sacrificable for speed (as long as it’s not an analytics suit you can afford the occasional collision).

    Would you like a seat reservation application to miss-fire and allow more users to grab a seat even after the seat cout was 0? of course not – here you want to leverage transactions and isolation levels to ensure that never happens.

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

Sidebar

Related Questions

I've done extensive research on this, and am baffled. Similar questions on stackoverflow have
I am trying to design an asic graphics processor. I have done extensive research
I'm new to build automation and Continuous Integration, but have done extensive research on
Have done some research and found some stuff that may be helpful. I would
I have done one program that allow user can listen to the music via
I have done some research and it really seems that implementing a transaction system
I have done extensive client-side validation through the help from jQuery. Now come to
I'm new to android. I have some java knowledge (not extensive), and I've done
I've done extensive research on this topic and intensive discussions with my co-workers. The
I have done extensive testing with this and have isolated the problem to this.

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.