Prepending EXPLAIN to your query will show you how the query optimizer wants to do the needed work to return the requested data from your database. However the output from EXPLAIN is not exactly easy to decipher. This session covers the basics of EXPLAIN use with PostgreSQL and MySQL so that you can understand what the out really means. You will learn the heuristics behind the choices made by the optimizer, some of which may not be optimal (such as MySQL's default of using the smaller of two available indexes), and some basic optimizations to speed up queries. And you will learn how to test and compare different optimization strategies for your queries.
Dave Stokes is a Technology Evangelist for Percona Corporation and is the Author of MySQL & JSON - A Practical Programming Guide now in a second edition