What is a deadlock and how do you avoid it?

SQL indexes, transactions and performance · Freshers and experienced

Model answer

Two transactions each hold a lock the other needs, so neither can continue, and the database aborts one. Reduce risk by accessing tables and rows in a consistent order, keeping transactions short, and retrying the aborted transaction.

Learn this topic

Indexes and Faster Queries: EXPLAIN for Beginners in the course SQL for Beginners: Learn Databases Step by Step.

Sign in to add your own answer.

More questions