Lab 02 — Index Access Paths
Source reference
This lab applies and PostgreSQL-adapts concepts from SQL/Query Optimization. See the coverage and terminology guide.
Scenario
A product lookup searches for a SKU without regard to letter case. The table has baseline indexes, but the expression applied to sku may change which access paths PostgreSQL can use.
Run the exercise
Investigate
- Identify the scan type and compare estimated rows with actual rows.
- Record rows removed by the filter and buffers touched.
- Inspect existing indexes on
commerce.products. - Explain whether the predicate matches an indexed expression.
- Form a hypothesis before testing any index change.
Diagnostic question
Why can a highly selective lookup still miss an apparently relevant index, and what plan evidence demonstrates the reason?