Problem Statement
Given a composite index (country, city, created_at), which WHERE clause is most likely to use the index efficiently?
Explanation
Composite B-trees are left-prefix. Predicates on leading columns enable seeks. Skipping the first column usually prevents efficient use. Adding a selective range on created_at after equality filters still works well.
Code Solution
SolutionRead Only
CREATE INDEX idx_loc_time ON places(country, city, created_at);
Practice Sets
This question appears in the following practice sets:
