# Statistics-based versus hard-wired selectivity

Derby determines the selectivity for a WHERE clause in one of two ways.

- Selectivity from cardinality statistics
  Cardinality statistics are computed by the Derby system and stored in the system tables.
- Selectivity from hard-wired assumptions
  In all other cases, Derby uses a fixed number that attempts to describe the percentage of rows that will probably be returned; it might not correspond to the actual selectivity of the operation in every case. It is an assumption hard-wired into the Derby system.

Parent topic: Selectivity and cardinality statistics
Related concepts
Determinations of rows scanned from disk for a table scan
Estimations of rows scanned from disk for an index scan
What are cardinality statistics?
Working with cardinality statistics