Rule of thumb — Orderbooks are always stored in memory, not in a database. This is because they change/are accessed so quickly.

If stored in the DB, they will be accessed too frequently, causing concurrency issues and high latency.

Orderbooks need to be fast. So there are two parts of the schema design

DB Schema design

Screenshot 2026-05-01 at 5.27.51 AM.png

Where are the bids stored? the asks? The last price at which the stock was traded?

Orderbook Schema design

Screenshot 2026-05-01 at 5.40.19 AM.png