Skip to content

The index that answered the whole query

sql SELECT student_id, score FROM submissions WHERE problem_id = 42;

An index on (problem_id) makes this fast. An index on (problem_id, student_id, score) makes it faster still. Why?