๐ŸŽ 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

Time-Series Database
A database optimized for storing and querying timestamped data points like metrics, sensor readings, and event logs.
Vacuum
A PostgreSQL maintenance operation that reclaims storage from dead tuples and updates statistics for the query planner.
Database Constraint
Rules enforced by the database to maintain data integrity, including NOT NULL, UNIQUE, CHECK, PRIMARY KEY, and FOREIGN KEY.
Normalization
The process of organizing database tables to reduce data redundancy and improve data integrity.
Elastic Search
A distributed search and analytics engine built on Apache Lucene, optimized for full-text search and log analysis.
Schema
The structure definition of a database including tables, columns, data types, relationships, indexes, and constraints.
View All Databases Terms โ†’