# Sort avoidance

Sorting is an expensive process. Derby tries to eliminate unnecessary sorting steps where possible.

- DISTINCT elimination based on a uniqueness condition
- Combining ORDER BY and DISTINCT
- Combining ORDER BY and UNION

Parent topic: Internal language transformations
Related concepts
Predicate transformations
Transitive closure
View transformations
Subquery processing and transformations
Outer join transformations
Aggregate processing