Problem Statement
Which column is the best candidate for an index from a selectivity perspective?
Explanation
High-selectivity columns filter out many rows per lookup. Unique keys are the most selective and typically index well.
Low-cardinality columns like boolean flags rarely help alone, though they can help as the leading column in a composite index for special cases.
Code Solution
SolutionRead Only
CREATE UNIQUE INDEX idx_users_email ON users(email);
Practice Sets
This question appears in the following practice sets:
