Playbooks
What do I do, and what does each option cost?
- 1
Choose who owns the memory
An engine allocates memory for data it processes: leave it to the garbage collector, or take it off-heap as an arena, a typed pool, a dictionary or capped buffers? Four questions, then two checks on placement and peak.
Choose - 2
Tune a buffer pool
A database caches disk pages in a buffer pool: isolate scans, use Clock, or pay for 2Q or ARC? Three questions pick the replacement policy; three checks find the pool's usable size and the failures upstream of the policy.
Choose - 3
Ration memory across queries
Many queries share one machine's memory: list what cannot spill, check where grants come from, size grants in steps, decide between reservation and over-commit, and keep the pressure loop from oscillating.
Design - 4
Plan for running out of memory
When a query outgrows its memory, it spills to disk or is killed: list what cannot spill, compute what spilling really costs on your hardware, guard against one oversized key, and make sure a killed query retries with more memory.
Design