mysql> explain SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id WHERE aFCK = 24 GROUP BY tours.htlCoK LIMIT 0,20;
+----+-------------+---------+--------+----------------------+----------+---------+-------------------+-------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+--------+----------------------+----------+---------+-------------------+-------+--------------------------+
| 1 | SIMPLE | tours | ref | afck,htlcok,combined | combined | 3 | const | 34338 | Using where |
| 1 | SIMPLE | tours_p | eq_ref | PRIMARY | PRIMARY | 4 | test.tours.htlCoK | 1 | Using where; Using index |
+----+-------------+---------+--------+----------------------+----------+---------+-------------------+-------+--------------------------+
2 rows in set (0.00 sec)
mysql> explain SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 44 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK LIMIT 0,20;
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| 1 | SIMPLE | tours_p | range | PRIMARY | PRIMARY | 4 | NULL | 81 | Using where; Using index; Using temporary; Using filesort |
| 1 | SIMPLE | tours | ref | afck,htlcok,combined | combined | 6 | const,test.tours_p.id | 29 | Using where |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> explain SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 144 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK ORDER BY COUNT(myid) LIMIT 0,20;
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| 1 | SIMPLE | tours_p | range | PRIMARY | PRIMARY | 4 | NULL | 81 | Using where; Using index; Using temporary; Using filesort |
| 1 | SIMPLE | tours | ref | afck,htlcok,combined | combined | 6 | const,test.tours_p.id | 29 | Using where |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> explain SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 72 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK LIMIT 0,20;
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
| 1 | SIMPLE | tours_p | range | PRIMARY | PRIMARY | 4 | NULL | 81 | Using where; Using index; Using temporary; Using filesort |
| 1 | SIMPLE | tours | ref | afck,htlcok,combined | combined | 6 | const,test.tours_p.id | 29 | Using where |
+----+-------------+---------+-------+----------------------+----------+---------+-----------------------+------+-----------------------------------------------------------+
2 rows in set (0.00 sec)
+----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Query_ID | Duration | Query |
+----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1 | 21.98517300 | SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id WHERE aFCK = 24 GROUP BY tours.htlCoK LIMIT 0,20 |
| 2 | 6.40927400 | SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 44 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK LIMIT 0,20 |
| 3 | 6.91070600 | SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 144 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK ORDER BY COUNT(myid) LIMIT 0,20 |
| 4 | 6.34701800 | SELECT * FROM tours_p JOIN tours ON tours.htlCoK = tours_p.id AND aFCK = 72 WHERE id BETWEEN 10 AND 90 GROUP BY tours.htlCoK LIMIT 0,20 |
+----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)