Where state actually lives, and the correctness problems that appear the moment two requests touch the same row.
- Databases in the Backend — [Intermediate] — modelling, querying, and the ORM tradeoff from the application’s side
Go deeper elsewhere
This section is deliberately thin because the depth already exists:
- Database design · SQL · NoSQL · MySQL — the reference layer
- Databases interview — the sharpest material: index internals, isolation levels and write skew,
EXPLAIN, connection pool sizing, and safely migrating a 500M-row table - Distributed transactions — isolation and MVCC in depth
The backend-specific parts
- Transaction boundaries belong in the service layer, not the repository — the service knows what must succeed together. → layers
- Concurrent writes are a correctness problem: optimistic locking (
@Version), pessimistic (SELECT … FOR UPDATE), or an atomic conditionalUPDATE … WHERE qty > 0. Know which your isolation level requires. - The connection pool is usually your real concurrency limit — and smaller is often faster. Time spent waiting for a connection is invisible unless you instrument it.
- N+1 queries are the most common performance regression, and they exhaust the pool, which makes them a service-wide incident. → production debugging
- Migrations must be backwards-compatible with the currently-running code — expand, migrate, contract.
Related
Jump to a subject
Software engineering
Infrastructure & security
Computer science
Hardware & engineering