Pick the fix
An e-commerce app needs orders, customers and inventory with stock that must never go negative across concurrent orders. Primary store?
Hint 1 of 1
Where are the cross-row rules?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A PostgreSQL with constraints and transactions (JSONB for product attributes)
Correct. Shared, related data with invariants across rows.
Stock that must never go negative across orders is a rule across many rows. Relational constraints and transactions enforce that in one place; JSONB still covers flexible product attributes.
Why not the others?
- B MongoDB with orders embedding customer and stock copies. Copies drift and stock checks across documents get hard.
- C Redis as the only store. Durability and constraints don't fit.
- D Elasticsearch. A search index, not a source of truth.