Tech
what is a purpose of index with order if the query has order 1 column, do we need to use order in index
For a query that sorts by only one column, you do not need to explicitly specify a sort direction (like DESC) when creating the index, because databases can read a single-column index both forward and backward with equal efficiency.The purpose of an index in this scenario is to eliminate the expensive "filesort" or explicit sorting step entirely. Since the data is already stored in order inside the index structure, the database engine simply scans the index and returns the rows directly in the r...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to