This chapter cannot end without discussing indexes. Entering into the details of indexes could be long drawn out and is out of the scope of this book. Anyway, we'll talk about them a bit and see what you should take care about.
Most of the time, indexes are the way to get very good query result performances. But if they are badly used, they could have an inverted effect.
Let's say your application makes a search on several columns. First of all, run an explain
command on the desired query and see what the explanation recommends. Maybe it will recommend to add some specific indexes to the columns. Do not add too many indexes only on the most used columns, or you'll waste resources.
If your application uses small tables, indexes won't make performance better. Indexes are useful on large tables.