Database Reference
In-Depth Information
Table optimization—explaining a query
In this section, we want to get some information about the index that MySQL uses
for a specific query, and the performance impact of not having defined an index.
Let's assume we want to use the following query:
SELECT *
FROM `book`
WHERE author_id = 2 AND language = 'es'
We want to know, which topics written by the author whose id is 2 , are in the es
language—our code for Spanish.
To enter this query, we use the SQL link from the database or the table menu, or the
SQL query window (see Chapter 12). We enter this query in the query box and click
Go . Whether the query finds any results, is not important right now.
You could obtain the same query by following explanations from Chapter
9 to produce a search for author_id 2 and language es .
Let's look at the links: [Edit] [Explain SQL] [Create PHP Code] [Refresh]
We will now use the [Explain SQL] link to get information about which index
(if any) has been used for this query:
 
Search WWH ::




Custom Search