To make sure your queries have been optimized and can run as quickly as they can, you want to ensure they are using the indexes on the table you are querying properly. As you learned in Chapter 4, Designing and Creating a Database, locking, blocking, and deadlocking play a role in your queries. If you use indexes properly with your queries, you will have less blocking and deadlocking to deal with because the index will allow you to query data faster.
Using indexes with your queries
Learning how to see what indexes your query is using
There is a simple way to see how MySQL will run your query, and that is to append EXPLAIN to the front of your query. For example, you can see EXPLAIN being used in the following query:
USE...