# Chapter 15 Solution: Optimization Checklist

Use this checklist after running the benchmark. The best answer is not always the fastest single result. A production optimization should improve the relevant service objective while keeping the system understandable, reproducible, and affordable.

| Question | Good answer pattern |
|---|---|
| What changed? | One variable changed at a time, such as adding an index, changing partition layout, or enabling a cache. |
| What was measured? | Median runtime, p95 runtime, data size, rows processed per second, and any storage or compute cost proxy. |
| Is the result reproducible? | The dataset seed, row count, query text, engine version, and hardware or container limits are recorded. |
| Who benefits? | The change improves a named workload, such as daily revenue reporting or fraud feature generation. |
| What is the trade-off? | Faster reads may require slower writes, larger storage, more metadata, or more operational complexity. |
| Should it be automated? | If the change prevents future regression, add it to CI, scheduled compaction, or an observability alert. |

A complete written answer should state the baseline, the optimized result, the relative improvement, the new cost or complexity, and the final recommendation. For example: “The indexed variant reduced median aggregation time from 0.42 seconds to 0.08 seconds on 100,000 rows, a 5.25x improvement, while increasing database size by 18%. Because this query powers a repeated dashboard and the table is append-heavy rather than update-heavy, the index is justified.”
