Database Performance
Plans, indexes, contention and the pool in front of the database.
6 to work through
-
advanced
A multi-tenant platform's database performance is fine for most tenants and severely degraded for a few. What are the likely causes and their fixes?
2 min answer -
advanced
A query that ran in 40 ms has taken 40 seconds since Tuesday. The query and the code are unchanged. What happened?
2 min answer -
advanced
A search product must choose between indexing throughput and query latency on the same hardware. How should the trade be made explicit and managed?
2 min answer -
advanced
A voucher-redemption feature creates a single hot row that thousands of buyers hit in the same second. Compare row-level locking, optimistic concurrency, bucketed counters and an in-memory reservation service.
3 min answer -
advanced
An application with ten million users has a database bottleneck. In what order do you intervene, and why is sharding last?
2 min answer -
advanced
Review this proposal. A team has six slow queries against a 400 GB table taking 40,000 writes a minute, and proposes adding six indexes, one per query. What would you remove, what would you change, and what would you keep?
3 min answer
4 terms in this topic
Database Performance
The interventions that resolve database bottlenecks, in the order they should be attempted.
patternIn-Memory Reservation Service
Moving a heavily-contended counter or inventory pool into a single-owner in-memory service that serialises decisions at memory speed and persists asy…
conceptIndex Write Amplification
The multiplication of write work caused by secondary indexes, where every insert and every update to an indexed column must also maintain each index …
conceptQuery Plan Regression
A sudden latency increase caused by the database optimiser choosing a different execution plan for an unchanged query, typically after statistics or …
Neighbouring topics
Performance & Capacity
General material on performance and capacity engineering.
Latency
Distributions rather than averages, and the floors physics imposes.
Throughput
Work completed per unit time, and why it trades against latency.
Concurrency
Operations in flight, and the limits that are the real capacity ceiling.
Queueing Theory
Why latency explodes as utilisation approaches capacity.
Little's Law
L = λW, and the pool sizes it computes directly.
Bottleneck Analysis
Finding the constraint, and expecting a second one behind it.
Tail Latency
p99 behaviour, amplification across fan-out, and hedged requests.
Load Testing
Realistic data, realistic mix, and a ramp rather than a step.
Stress Testing
Pushing past target to learn what breaks first and how it fails.
Soak Testing
Long runs that surface leaks and slow degradation.
Capacity Modelling
Arithmetic before load tests, and headroom for failure as well as peak.
Horizontal vs Vertical Scaling
Scale out for stateless, scale up first for stateful.
Caching for Performance
Layer choice, hit ratio as a first-class metric, and cold-cache recovery.
Connection Pooling
The most common hidden ceiling, and the metric nobody collects.
Network Performance Tuning
Keep-alive, compression, payload size and round-trip elimination.
Performance Budgets
Targets enforced in CI so regressions fail the build.
Profiling & Optimisation
Measuring before optimising, and optimising the dominant term.
Peak Event Readiness
Freeze, pre-scale, shed order, warm caches and rehearse.