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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:59:43+00:00 2026-06-01T12:59:43+00:00

So I was looking at row locking for innoDB and it seems like SELECT…FOR

  • 0

So I was looking at row locking for innoDB and it seems like SELECT...FOR UPDATE is the go to query for locking. In my file I have three queries. Two updates and then an insertion. Is there a way to make sure that for each connection the rows are locked and then these three queries can run before someone else can change the rows?

Here are the queries:

"UPDATE table SET r=r+2 WHERE r > '$l' AND home='$home'";

"UPDATE table SET l=l+2 WHERE l > '$l' AND home='$home'";

"INSERT INTO table (value, home, l, r, value2)
            VALUES ('$value', '$home', '$l'+1, '$l'+2, value2) ";

To clarify: I want to lock all the rows where home=$home and then free them after the three queries. I want to make sure the three queries are executed before any other connections can have write abilities to those rows.

  • 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-01T12:59:45+00:00Added an answer on June 1, 2026 at 12:59 pm

    Use transactions, your changes are not visible to others until you commit them explicitly.

    Further informations: msql docs on transactions

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

Sidebar

Related Questions

In manual it said that InnoDB has row-level locking, so why if I select
I would like one of my table to have row level locking. I am
I've been looking at fast ways to select a random row from a table
What is the Linq equivalent for row locking hints in SQL? For example: select
In MySQL with REPEATABLE_READ isolation mod, my transaction is like this: select a row
I am looking to select the last td in each row and using this
Ok, I have three tables. The parent table is Listings and two child tables
I want to understand how locking works in SQL Server (2005/2008) during select, update,
Due to performance issues arising from row locking and a long running query in
In SQL Server I used the following hints inside queries: rowlock (row level locking)

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.