Problem solve Get help with specific problems with your technologies, process and projects.

How Oracle handles concurrent queries

How does Oracle handle two concurrent queries, one for an update and one for deletion of tables simultaneously?

Oracle will lock the row(s) being effected by the first process to request the lock, and the second operation will wait until the first operation finishes. At that time, the second operation will execute. There's really no such thing as "concurrent" in the sense that one transaction will get to the data first and the other will have to wait for it.

If the two operations do not effect the same rows, then they can both execute at the same time. Oracle locks at the row level so if you lock a row to update it, and at the same time another session tries to delete a different row, both will succeed. Only when you try to do manipulation of the same row will the locking mechanism hold one session until the first one to achieve the lock completes.

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle and SQL

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.