๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Databases Advanced

What is Deadlock?

A situation where two or more transactions permanently block each other by each holding locks that the other needs.

A deadlock occurs when Transaction A locks Row 1 and waits for Row 2, while Transaction B locks Row 2 and waits for Row 1. Neither can proceed. Databases detect deadlocks and abort one transaction to break the cycle.

Prevention strategies include consistent lock ordering (always lock resources in the same order), keeping transactions short, using appropriate isolation levels, and using SELECT FOR UPDATE SKIP LOCKED for queue patterns.

Related Terms

MVCC (Multi-Version Concurrency Control)
A technique where the database maintains multiple versions of data to allow concurrent reads and writes without locking.
Connection String
A formatted string containing all parameters needed to establish a connection to a database server.
View
A virtual table defined by a SQL query that provides a simplified or restricted view of data from one or more tables.
Redis
An open-source, in-memory data store used as a database, cache, message broker, and queue with sub-millisecond response times.
Connection Pool
A cache of database connections that can be reused, avoiding the overhead of creating new connections for each request.
Graph Database
A database that uses graph structures with nodes, edges, and properties to store and query highly connected data.
View All Databases Terms โ†’