Comment 6 for bug 929732

Revision history for this message
Sergey Petrunia (sergefp) wrote :

Took the original query and changed table names inside deepest-level subqueries to be v2, v3, v4 (so we can tell them apart in the counters), and I get this:

+----+-------------+-------+--------+---------------+---------+---------+-----------------------+------+-------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------+------+-------------------------------------------+
| 1 | PRIMARY | v | range | cid,did | did | 17 | NULL | 275 | Using where; Using index |
| 1 | PRIMARY | v2 | ref | cid,did | cid | 16 | bug929732.v.cid,const | 1 | Using where; Using index; Start temporary |
| 1 | PRIMARY | v3 | ref | cid,did | cid | 16 | bug929732.v.cid,const | 1 | Using where; Using index |
| 1 | PRIMARY | v4 | ref | cid,did | cid | 16 | bug929732.v.cid,const | 1 | Using where; Using index |
| 1 | PRIMARY | c | eq_ref | PRIMARY | PRIMARY | 8 | bug929732.v.cid | 1 | Using where |
| 1 | PRIMARY | c2 | eq_ref | PRIMARY | PRIMARY | 8 | bug929732.v.cid | 1 | Using where; End temporary |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------+------+-------------------------------------------+
6 rows in set (0.00 sec)

statistics shows this:
MariaDB [bug929732]> SHOW TABLE_STATISTICS;
+--------------+------------+-----------+--------------+-------------------------+
| Table_schema | Table_name | Rows_read | Rows_changed | Rows_changed_x_#indexes |
+--------------+------------+-----------+--------------+-------------------------+
| bug929732 | v | 276 | 0 | 0 |
| bug929732 | v2 | 3994 | 0 | 0 |
| bug929732 | v3 | 53506 | 0 | 0 |
| bug929732 | v4 | 837280 | 0 | 0 |
| bug929732 | c | 498 | 0 | 0 |
+--------------+------------+-----------+--------------+-------------------------+
5 rows in set (0.00 sec)

MariaDB [bug929732]> SHOW INDEX_STATISTICS;
+--------------+------------+------------+-----------+
| Table_schema | Table_name | Index_name | Rows_read |
+--------------+------------+------------+-----------+
| bug929732 | v | did | 276 |
| bug929732 | v2 | cid | 3994 |
| bug929732 | v3 | cid | 53506 |
| bug929732 | v4 | cid | 837280 |
| bug929732 | c | PRIMARY | 498 |
+--------------+------------+------------+-----------+