Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. mysql> EXPLAIN SELECT * from `picks` WHERE `match_id` in (SELECT `match_id` from `picks` WHERE `match_id` in (SELECT `id` FROM `matches` WHERE date >= '2014-01-27' AND date < '2999-01-01') AND `hero_id` = 1 AND `type` = 'pick' AND `team` = 0 GROUP BY `match_id`) AND `type` = 'pick' AND `team` = 1
  2. ->
  3. -> ;
  4. +----+--------------------+---------+-----------------+--------------------------+--------------+---------+-------+------+-----------------------------------------------------------------------------+
  5. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  6. +----+--------------------+---------+-----------------+--------------------------+--------------+---------+-------+------+-----------------------------------------------------------------------------+
  7. | 1 | PRIMARY | picks | ref | type,team,type_2 | type | 6 | const | 3999 | Using where |
  8. | 2 | DEPENDENT SUBQUERY | picks | index_merge | type,team,type_2,hero_id | hero_id,team | 4,4 | NULL | 6 | Using intersect(hero_id,team); Using where; Using temporary; Using filesort |
  9. | 3 | DEPENDENT SUBQUERY | matches | unique_subquery | PRIMARY | PRIMARY | 4 | func | 1 | Using where |
  10. +----+--------------------+---------+-----------------+--------------------------+--------------+---------+-------+------+-----------------------------------------------------------------------------+
  11. 3 rows in set (0.00 sec)
  12.  
  13.  
  14.  
  15. mysql> SHOW CREATE TABLE picks;
  16. +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | Table | Create Table |
  18. +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | picks | CREATE TABLE `picks` (
  20. `match_id` int(11) NOT NULL,
  21. `hero_id` int(3) NOT NULL,
  22. `order` int(2) NOT NULL,
  23. `type` varchar(4) NOT NULL,
  24. `team` int(1) NOT NULL,
  25. UNIQUE KEY `match_id` (`match_id`,`order`),
  26. KEY `match_id_2` (`match_id`),
  27. KEY `type` (`type`),
  28. KEY `team` (`team`),
  29. KEY `type_2` (`type`),
  30. KEY `hero_id` (`hero_id`),
  31. KEY `match_id_3` (`match_id`)
  32. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
  33. +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. 1 row in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement