cvs: presentations /slides/optimizing-mysql-and-php explain.xml
| From: | jim winstead | Date: | Mon, 03 Nov 2003 17:27:15 +0000 |
| Subject: | cvs: presentations /slides/optimizing-mysql-and-php explain.xml | ||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-889@lists.php.net to get a copy of this message | ||
jimw Mon Nov 3 12:27:15 2003 EDT
Modified files:
/presentations/slides/optimizing-mysql-and-php explain.xml
Log:
explain EXPLAIN
Index: presentations/slides/optimizing-mysql-and-php/explain.xml
diff -u presentations/slides/optimizing-mysql-and-php/explain.xml:1.1
presentations/slides/optimizing-mysql-and-php/explain.xml:1.2
--- presentations/slides/optimizing-mysql-and-php/explain.xml:1.1 Mon Nov 3 11:28:01 2003
+++ presentations/slides/optimizing-mysql-and-php/explain.xml Mon Nov 3 12:27:14 2003
@@ -1,3 +1,42 @@
<slide title="EXPLAIN">
-<!-- TODO -->
+
+<example fontsize="1.8em">
+EXPLAIN SELECT City.Name,Country.Name,City.Population FROM City, Country
+ WHERE City.CountryCode = Country.Code AND City.Population > 8000000
+ ORDER BY City.Population;
+</example>
+
+<example type="shell" fontsize="1.3em">
++---------+--------+---------------+---------+---------+------------------+------+-----------------------------+
+| table | type | possible_keys | key | key_len | ref | rows | Extra
|
++---------+--------+---------------+---------+---------+------------------+------+-----------------------------+
+| City | ALL | NULL | NULL | NULL | NULL | 4079 | Using where;
Using filesort |
+| Country | eq_ref | PRIMARY | PRIMARY | 3 | City.CountryCode | 1 |
|
++---------+--------+---------------+---------+---------+------------------+------+-----------------------------+
+</example>
+
+<list>
+ <bullet>%system%: table only has one row</bullet>
+ <bullet>%const%: query matches at most one row from this table</bullet>
+ <bullet>%eq_ref%: one row from this table will match from previous tables</bullet>
+ <bullet>%ref%: rows matching from this table will match reference from earlier
table</bullet>
+ <bullet>%ref_or_null%: like ref, but also matching null references (used by
subqueries)</bullet>
+ <bullet>%range%: range of rows will be retrieved</bullet>
+ <bullet>%index%: the entire index will be scanned</bullet>
+ <bullet>%ALL%: the entire table will be scanned</bullet>
+</list>
+
+<example title="Add a new index">
+ALTER TABLE City ADD INDEX (population);
+</example>
+
+<example type="shell" fontsize="1.3em">
++---------+--------+---------------+------------+---------+------------------+------+-------------+
+| table | type | possible_keys | key | key_len | ref | rows | Extra |
++---------+--------+---------------+------------+---------+------------------+------+-------------+
+| City | range | Population | Population | 4 | NULL | 78 | Using where |
+| Country | eq_ref | PRIMARY | PRIMARY | 3 | City.CountryCode | 1 | |
++---------+--------+---------------+------------+---------+------------------+------+-------------+
+</example>
+
</slide>