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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:38:14+00:00 2026-06-10T18:38:14+00:00

I am currently playing around with MySQL and PHP, and I was wondering about

  • 0

I am currently playing around with MySQL and PHP, and I was wondering about table locks. From the MySQL documentation I know that MySQL applies table wide read locks, which can cause other queries to wait until the select query finishes.

When I am using PHP to query data like in this example:

$dbConnection = mysql_connect($dbHost, $dbUser, $dbPass) 
mysql_select_db($dbName, $dbConnection) 

$qry = "select * from bigTable";
$result = mysql_query($qry, $dbConnection);

//Read Data

mysql_close($dbConnection);

When, from the perspective of the PHP code, will the read lock get removed from “bigTable”?

Thank you,
Emi

  • 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-10T18:38:16+00:00Added an answer on June 10, 2026 at 6:38 pm

    The lock is released at the end of your read query:

    $result = mysql_query($qry, $dbConnection);
    

    because you are doing per-query transactions.

    If you want to do more complex transactions, make sure that you use the innodb engine and start your transaction:

    mysql_query("START TRANSACTION", $dbConnection)
    mysql_query("BEGIN", $dbConnection);
    

    Then do your work:

    • for example read a table
    • then write some values, etc.

    and either commit or rollback the transaction:

    mysql_query("COMMIT", $dbConnection);
    mysql_query("ROLLBACK", $dbConnection);
    

    depending if you want the changes to go through or not.

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

Sidebar

Related Questions

Sorry about the weird title, I'm currently playing around with WinForms and I'm wondering
I am currently playing around with and reading up on Prism. I know that
I'm am currently playing around with the third party facial recognition api from face.com.
I am currently learning about basic networking in java. I have been playing around
I have just been playing around with IPython. Currently I am wondering how it
I am currently playing around with the FileSystemWatcher class wanted to know how to
I'm currently playing around with HTML_QuickForm for generating forms in PHP. It seems kind
I am currently playing around with Script# (version 0.6.3) which complains about the following
I am currently playing around with different scraping techniques and found out, that it
I'm playing around with emailing from nodeJS (using the nodemailer lib), and I'm currently

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.