LooseScan Strategy
The idea
SELECT * FROM Country
WHERE
Country.code IN (SELECT country_code FROM Satellite)

LooseScan in action
Factsheet
Last updated
Was this helpful?
SELECT * FROM Country
WHERE
Country.code IN (SELECT country_code FROM Satellite)

Last updated
Was this helpful?
Was this helpful?
MariaDB [world]> EXPLAIN SELECT * FROM Country WHERE Country.code IN
(select country_code from Satellite);
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+
| 1 | PRIMARY | Satellite | index | country_code | country_code | 9 | NULL | 932 | Using where; Using index; LooseScan |
| 1 | PRIMARY | Country | eq_ref | PRIMARY | PRIMARY | 3 | world.Satellite.country_code | 1 | Using index condition |
+----+-------------+-----------+--------+---------------+--------------+---------+------------------------------+------+-------------------------------------+expr IN (SELECT tbl.keypart1 FROM tbl ...)expr IN (SELECT tbl.keypart2 FROM tbl WHERE tbl.keypart1=const AND ...)