Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1.  
  2. MariaDB [test]> explain select a, (select sum(X.a+B.b) from ten X, t1big B where B.a=A.a or B.b=A.a) from ten A;
  3. +----+--------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
  4. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  5. +----+--------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
  6. | 1 | PRIMARY | A | ALL | NULL | NULL | NULL | NULL | 10 | |
  7. | 2 | DEPENDENT SUBQUERY | X | ALL | NULL | NULL | NULL | NULL | 10 | |
  8. | 2 | DEPENDENT SUBQUERY | B | ALL | a,b | NULL | NULL | NULL | 1000 | Using where; Using join buffer (flat, BNL join) |
  9. +----+--------------------+-------+------+---------------+------+---------+------+------+-------------------------------------------------+
  10.  
  11. MariaDB [test]> create table all_numbers (a int primary key);
  12. MariaDB [test]> insert into all_numbers select * from test.one_k;
  13.  
  14.  
  15. MariaDB [test]> explain select a, (select sum(X.a+B.b) from ten X, t1big B, all_numbers where B.a=all_numbers.a or B.b=all_numbers.a and all_numbers.a=A.a) from ten A;
  16. +----+--------------------+-------------+-------+---------------+---------+---------+------+------+-------------------------------------------------+
  17. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  18. +----+--------------------+-------------+-------+---------------+---------+---------+------+------+-------------------------------------------------+
  19. | 1 | PRIMARY | A | ALL | NULL | NULL | NULL | NULL | 10 | |
  20. | 2 | DEPENDENT SUBQUERY | X | ALL | NULL | NULL | NULL | NULL | 10 | |
  21. | 2 | DEPENDENT SUBQUERY | all_numbers | index | PRIMARY | PRIMARY | 4 | NULL | 1000 | Using index; Using join buffer (flat, BNL join) |
  22. | 2 | DEPENDENT SUBQUERY | B | ALL | a,b | NULL | NULL | NULL | 1000 | Range checked for each record (index map: 0x3) |
  23. +----+--------------------+-------------+-------+---------------+---------+---------+------+------+-------------------------------------------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement