310-811 Free Dumps Study Materials
Question 13: Given the following MyISAM table structure:
mysql> desc city;
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| ID | int(11) | | PRI | NULL | auto_increment |
| Name | char(35) | | | | |
| CountryCode | char(3) | | | | |
| District | char(20) | | | | |
| Population | int(11) | | MUL | 0 | |
+-------------+----------+------+-----+---------+----------------+
and the following SQL statement:
SELECT Population
FROM city
WHERE Population = 10000
ORDER BY Population
LIMIT 5;
which of the following statements best describes how MySQL optimizer executes the query?
A. The optimizer uses the primary key column ID to read the index values, then uses the index on
Population to filter the results. The optimizer will always choose to use a unique index first, then use a
secondary index if available.
B. The optimizer uses the index on the Population column to search and filter the WHERE clause. A
temporary table is used to perform a filesort on the results, and then only 5 records are returned to the
client.
C. The optimizer uses the index on the Population column to search, filter and sort the Population column,
then returns 5 records to the client. The optimizer does not need to read the data rows, and can return
values from the index only, because the index contains just integer values that form a leftmost prefix for
the key.
D. The optimizer uses the index on the Population column to search, filter and sort the Population column,
and returns 5 records to the client. The optimizer does not need to read the data rows, and can return
values from the index only because only those columns where specified in the SELECT statement.
E. The optimizer will never read data from disk, since MySQL caches both data and index in the key
buffer.
Correct Answer: D