SQL Insights

Illustrate a Deadlock

I've always had trouble relating a deadlock in SQL to a real-world example. With that in mind, I'll give it a shot.

Imagine my two sons, Henry and Liam. They both want to play video games. Henry picks up the only controller and starts searching for the Mario Kart cartridge. Liam has the cartridge in hand but wants to play first and is waiting for the controller. Now, they're stuck, each holding onto something the other needs and not willing to give up. That’s a deadlock.

We could easily solve this by purchasing another controller and suggesting the boys take turns deciding who goes first. But that would destroy my example. ChatGPT Image May 13, 2025, 08_45_27 AM