# Quick DISTINCT scans

Derby can use a hash table instead of a sorter to eliminate duplicates when performing a DISTINCT in the following cases:

- There is a single table in the query block.
- An ORDER BY clause is not merged into the DISTINCT.
- All entries in the SELECT list are simple column references.
- There are no predicates in the query block.

This technique allows for minimal locking when performing the scan at the READ COMMITTED isolation level.
Note: This technique appears in RunTimeStatistics as a DistinctScanResultSet.
Parent topic: DISTINCT