Table Pullout Optimization
The idea of Table Pullout
SELECT *
FROM City
WHERE City.Country IN (SELECT Country.Code
FROM Country
WHERE Country.Population < 100*1000);SELECT City.*
FROM
City, Country
WHERE
City.Country=Country.Code AND Country.Population < 100*1000;Table pullout in action
MySQL [world]> EXPLAIN SELECT * FROM City WHERE City.Country IN (SELECT Country.Code FROM Country WHERE Country.Population < 100*1000);
+----+--------------------+---------+-----------------+--------------------+---------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+--------------------+---------+-----------------+--------------------+---------+---------+------+------+-------------+
| 1 | PRIMARY | City | ALL | NULL | NULL | NULL | NULL | 4079 | Using where |
| 2 | DEPENDENT SUBQUERY | Country | unique_subquery | PRIMARY,Population | PRIMARY | 3 | func | 1 | Using where |
+----+--------------------+---------+-----------------+--------------------+---------+---------+------+------+-------------+
2 rows in set (0.00 sec)Table pullout fact sheet
Controlling table pullout
Last updated
Was this helpful?

