# Using Indexes to Satisfy `ORDER BY` Clause

+ The attribute **`keep order`** in the **`operator info`** column indicates the usage of indexes
+ **`true`** indicates a sort operation is skipped
+ **`false`** indicates a sort operation is necessary to satisfy the **`ORDER BY`** clause

![`smart`](UseIndexes2SatisfyOrderBy01_en_001_20230129.png)

------------------------------------------------------------------------------
The `Sort_5` operator in the execution plan indicates that sorting for the SQL query is handled in the TiDB Server's cache. To optimize the `ORDER BY` clause, we can leverage the order of indexed columns. As shown in the slide, indexes are present on the `GENDER` and `HIRE_DATE` columns but not on the `last_name` column, which requires sorting. Consequently, the existing indexes cannot assist with sorting. To address this, we will design a new index that incorporates the sorting column to push the sorting operation down to the index level.
