Always create indexes

Useful indexes prevent Derby from having to read an entire table to retrieve the data you need.

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.

Related concepts
Prevent the user from issuing expensive queries