Sorted Index

suggest change

If 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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents