8.2.1.1 Speed of SELECT Statements

In general, when you want to make a slow SELECT ... WHERE query faster, the first thing to check is whether you can add an index. Indexes are especially important for queries that reference different tables, using features such as joins and foreign keys. You can use the EXPLAIN statement to determine which indexes are used for a SELECT. See Section 8.8.1, “Optimizing Queries with EXPLAIN”, and Section 8.3.1, “How MySQL Uses Indexes”.