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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:28:27+00:00 2026-05-10T19:28:27+00:00

In order to handle concurrency issue, is locking– any form of locking, whether it’s

  • 0

In order to handle concurrency issue, is locking– any form of locking, whether it’s row, table or database locking a good solution?

If not, how to handle concurrency issue?

  • 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. 2026-05-10T19:28:28+00:00Added an answer on May 10, 2026 at 7:28 pm

    If you believe Oracle, no, not at all. That’s because Oracle went to great lengths to avoid it.

    The problem is that readers can block writers and writers block readers, and a writer has to wait until all readers have finished with a row before it can write. That delays the writing process and its caller. Exclusive locks (for writing) are held to the end of the transaction, in case the transaction has to be rolled back – this stops other transactions seeing the new value until the transaction commits.

    In practice locking is generally fine if there isn’t too much contention, the same as with any concurrent programming. If there’s too much contention for a row/page/table (not many database servers do whole-DB locking), it will cause the transactions to execute in turn rather than concurrently.

    Oracle uses row-versioning, where instead of locking a row to write it, a new version of the row is created instead. Readers that need to repeat their reads remember which version of the row they read. However, an error will occur if a reader that’s remembering its reads tries to update a row that has been updated by another writer since this transaction read it; this is to stop lost updates. To ensure you can update a row, you have to say that the SELECT is FOR UPDATE; if you do that, it takes a lock – only one transaction can hold a row FOR UPDATE at a time, and a conflicting transaction has to wait.

    SQL Server 2005 and later support Snapshot Isolation, which is their name for row-versioning. Again, you should ask for update locks if you need to update some data you just read – in SQL Server, use WITH (UPDLOCK).

    A further problem with locking is the likelihood of deadlocks. This is simply where two transactions each hold a lock on a resource the other needs, or in general a cycle of transactions hold locks that each other need to progress. The database server will generally detect this deadlock and kill one of the transactions, rolling it back – you then need to retry the operation. Any situation where you have multiple concurrent transactions modifying the same rows has potential for deadlock. The deadlock will occur if the rows are touched in a different order; it’s very hard to enforce the order that the database server will use (generally you want the optimizer to pick the fastest order, which won’t necessarily be consistent across different queries).

    Generally I would suggest the same as with threading – go with locks until you can prove that they’re causing a scalability problem, then work out how to make the most critical sections lock-free.

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

Sidebar

Related Questions

I wrote the following snippet in order to handle errors. (Page.php gets included in
I am using Autofac to handle dependency injection in my application. In order not
I am trying to handle a contenteditable body in an iframe, in order to
I've implemented a custom UIButton and in order for me to handle LongPress events
In order to handle multiple resolutions I have following controls in the same xaml
I currently develop a task queue with a RESTful API. In order to handle
I'm developing a lex/yacc c compiler. In order to handle failures and parse errors,
What is the nice way of extending ObjectDataSource in order to handle CRUD errors.
my protocol: @protocol ElectricalSystemEngineDelegate -(void)didRequestMainMenu:(id)sender; @end I designed this protocol in order to handle
I was searching a way to use nine-patch images in order to handle multiple

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.