Data & storage / 1 / 11
SQL and NoSQL
One shop, several kinds of data. Orders need joins and transactions, an order page wants one read, page views arrive tens of thousands a second, a cart is fetched by one key. How to choose a store by the way the data is read and written, and what happens when the questions change.
- 13 min
- Beginner
- 11 steps
- Query p95
- 28 ms
- Rows read per query
- 3
- Writes accepted
- 400 /s
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
API → Relational DBRequest
SELECT o.id, o.created_at, p.name, i.qty
FROM orders o
JOIN order_items i ON i.order_id = o.id12
JOIN products p ON p.id = i.product_id
WHERE o.id = 901;
Response
3 rows in 4 ms3
JOIN— Combine rows of two tables where the keys match.ON— The rule for matching: an order line belongs to the order with this ID.3 rows— One row per order line, already combined with the product name.
Course: 42 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes