Keywords: Indexes, performance benefits of

# Always create indexes

Have you ever thought what it would be like to look up a phone number in the phone book of a major metropolitan city if the book were not indexed by name? For example, to look up the phone number for John Jones, you could not go straight to the J page. You would have to read the entire book. That is what a table scan is like. Derby has to read the entire table to retrieve what you are looking for unless you create useful indexes on your table.

- Create useful indexes
  Indexes are useful when a query contains a WHERE clause.
- Make sure indexes are being used, and rebuild them
- Think about index order
- Think about join order
- Decide whether a descending index would be useful

Parent topic: Avoiding table scans of large tables
Related concepts
Prevent the user from issuing expensive queries