Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 April Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?

Database Theory: What is Timeout, Lock, Block, and Deadlock in a Database System?

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

Deadlock Blocking Locking

Timeout:

When the client application is waiting for a require resource, Timeout occurs.

There are multiple reasons for Timeout like transaction blocking, the distance network, high CPU utilization and multiple request user request at one time.

The Database Timeout cannot affect to other running connection, and it treated independently, but for solving the Timeout issue we need to check other causes like OS response, Network response, Database Timeout threshold value, number of Database Connections and other.

Lock:

When one process is accessing an object, it can request for a lock for that particular object so that other processes cannot perform read or update on that object.

There are different types of lock like Exclusive Lock, Non-exclusive Lock.

An Exclusive Lock prevents object or data from the reading and writing both the actions.
A Non-Exclusive Lock allows read-only access for an object or data, but it prevents the write action for an object or data.

Block:

If two processes are accessing the same resource so at that time one process has to wait until the other process releases the occupied resource.

This is called blocking because one transaction is blocked by another transaction and all blocked processes kept in the waiting queue.

If the blocked transaction is waiting for a long time, it may generate a Database Timeout.
If the long-running blocked transaction requires a lock, it may generate a Database Deadlock.

Deadlock:Database Deadlock

One X process is waiting to complete the transaction of the Y process, and the same time, Y process is blocked because it is also waiting to complete the transaction of the X process.
This is called as Deadlock situation.

In the Deadlock situation, both the processes trying to access a particular resource and also has a lock on that resource by each other, so both are waiting for each other to release a lock and complete the transaction.

Deadlock is a next stage of the blocking situation so if you want to avoid Deadlock situation, you should first find the blocked transaction and tried to remove internal dependency for those transactions.

Apr 6, 2016Anvesh Patel
SQL Server: What is SNAPSHOT Isolation Level?Database Theory: What is Optimistic Locking and Pessimistic Locking?
Comments: 3
  1. ch37ann
    April 27, 2019 at 4:31 pm

    Thanks for the article. Can you please suggest timeout variables to manage sessions applicable to PostgreSQL DB.

  2. Prasanna Kumar
    December 23, 2019 at 7:31 am

    How to check Database Timeout threshold value ?

  3. Prasanna Kumar
    December 23, 2019 at 8:56 am

    Thanks for the article , Can you tell me that how to check other Database Timeout threshold value !! ? :I :

Anvesh Patel

Database Engineer

April 6, 2016 Database TheoryAnvesh Patel, block, database, database concept, database research and development, database standards, Database Theory, database topic, dbrnd, DeadLock, lock, RDBMS, Timeout
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....