PHP and MySQL Web Development - P57: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 252 Chapter 11 Advanced MySQL . . . . . . . . j table j type j possible_keys j key j key_len j ref rows j Extra . . . . . . . . j orders j ALL j PRIMARY j NULL j NULL j NULL 4 j order_items j ref j PRIMARY j PRIMARY j 4 j 1 Using index j j customers j ALL j PRIMARY j NULL NULL NULL 3 where used j j books j eq_ref j PRIMARY j PRIMARY 13 j 1 where used j . . . . . . . Figure The output of the EXPLAIN statement. This might look confusing at first but it can be very useful. Let s look at the columns in this table one by one. The first column table just lists the tables used to answer the query. Each row in the result gives more information about how that particular table is used in this query. In this case you can see that the tables used are orders order_items customers and books. We knew this already by looking at the query. The type column explains how the table is being used in joins in the query. The set of values this column can have is shown in Table values are listed in order from fastest to slowest in terms of query execution. It gives you an idea of how many rows need to be read from each table in order to execute a query. Table Possible Join Types as Shown in Output from EXPLAIN Type Description const or system The table is read from only happens when the table has exactly one type system is used when it is a system table and the type const otherwise. eq_ref For every set of rows from the other tables in the join we read one row from this is used when the join uses all the parts of the index on the table and the index is UNIQUE or is the primary key. ref For every set of rows from the other tables in the join we read a set of rows from this table which all match. This is used when the join cannot choose a single row based on the join condition that is when only part of the key is used in the join or if it is not UNIQUE or a primary key. range For every set of rows from the .