Sorted Index
suggest changeIf an index is ordered the same way as the query, the engine can retrieve rows in that order and skip a separate sort. Descending index keys are not available in every dialect.
CREATE INDEX ix_scoreboard_score ON scoreboard (score DESC);
When you execute the query
SELECT * FROM scoreboard ORDER BY score DESC;
It can then walk the index in that order. The optimizer is free to choose another plan.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents