---
title: "Discussion on \"The Double-Booked Seat: Fixing a Booking Race Condition in Postgres\" | Hashnode"
description: "Discussion on \"The Double-Booked Seat: Fixing a Booking Race Condition in Postgres\". Scenario: two users hit Book on the last seat at the same moment. The code checks that the seat is available, charges the card, then marks the seat as booked. Who gets the seat?\nBoth of them. Run the"
url: "https://hashnode.com/posts/the-double-booked-seat-fixing-a-booking-race-condition-in-postgres/6afd2023ebfaeb1b2db83a1c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The Double-Booked Seat: Fixing a Booking Race Condition in Postgres](https://buildsaas.hashnode.dev/the-double-booked-seat-fixing-a-booking-race-condition-in-postgres?utm_source=hashnode&utm_medium=feed)

Scenario: two users hit Book on the last seat at the same moment. The code checks that the seat is available, charges the card, then marks the seat as booked. Who gets the seat? Both of them. Run the

Nov 18 · 10 min read · buildsaas.hashnode.dev  
Read the article

-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#system-design](https://hashnode.com/tag/system-design)
-   [#concurrency](https://hashnode.com/tag/concurrency)
-   [#databases](https://hashnode.com/tag/databases)

## Written by

[somnath khadanga](https://hashnode.com/@somanath-khadanga)

@somanath-khadanga · Bangalore, India

  
[View profile](https://hashnode.com/@somanath-khadanga)

I'm a senior engineer who builds and ships SaaS products for founders — Next.js, Node.js, AI features, and the boring production work

I'm a senior engineer who builds and ships SaaS products for founders — Next.js, Node.js, AI features, and the boring production work that keeps it all running after launch.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
