Guest User

Untitled

a guest
May 25th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. ## blah blah blah
  2.  
  3. mysql> explain SELECT `products`.* FROM `products` INNER JOIN `lines` on `products`.line_id = `lines`.id WHERE (`lines`.gender in ('w')) ORDER BY `products`.orders_count desc LIMIT 0, 12;
  4. +----+-------------+----------+------+------------------------------------------------+--------------------------------------------+---------+------------------------+------+-----------------------------------------------------------+
  5. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  6. +----+-------------+----------+------+------------------------------------------------+--------------------------------------------+---------+------------------------+------+-----------------------------------------------------------+
  7. | 1 | SIMPLE | lines | ref | PRIMARY,index_lines_on_gender_and_orders_count | index_lines_on_gender_and_orders_count | 6 | const | 1782 | Using where; Using index; Using temporary; Using filesort |
  8. | 1 | SIMPLE | products | ref | index_products_on_line_id_and_orders_count | index_products_on_line_id_and_orders_count | 5 | nuperfume_dev.lines.id | 2 | Using where |
  9. +----+-------------+----------+------+------------------------------------------------+--------------------------------------------+---------+------------------------+------+-----------------------------------------------------------+
  10. 2 rows in set (0.00 sec)
  11.  
  12. mysql> show create table `lines`\G
  13. *************************** 1. row ***************************
  14. Table: lines
  15. Create Table: CREATE TABLE `lines` (
  16. `id` int(11) NOT NULL auto_increment,
  17. `maker_id` varchar(255) default NULL,
  18. `name` varchar(255) default NULL,
  19. `gender` varchar(1) default NULL,
  20. `description` text,
  21. `introduced` int(11) default NULL,
  22. `category` varchar(255) default NULL,
  23. `recommended_use` varchar(255) default NULL,
  24. `notes` varchar(255) default NULL,
  25. `character` varchar(255) default NULL,
  26. `orders_count` int(11) default NULL,
  27. `popularity` int(11) default NULL,
  28. `created_at` datetime default NULL,
  29. `updated_at` datetime default NULL,
  30. `permalink` varchar(255) default NULL,
  31. PRIMARY KEY (`id`),
  32. KEY `index_lines_on_maker_id` (`maker_id`),
  33. KEY `index_lines_on_name` (`name`),
  34. KEY `index_lines_on_permalink_and_gender` (`permalink`,`gender`),
  35. KEY `index_lines_on_gender_and_orders_count` (`gender`,`orders_count`),
  36. KEY `index_lines_on_name_and_orders_count` (`name`,`orders_count`),
  37. KEY `index_lines_on_category` (`category`)
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  39. 1 row in set (0.01 sec)
  40.  
  41. mysql> show create table products\G
  42. *************************** 1. row ***************************
  43. Table: products
  44. Create Table: CREATE TABLE `products` (
  45. `id` int(11) NOT NULL auto_increment,
  46. `line_id` int(11) default NULL,
  47. `content` varchar(255) default NULL,
  48. `size` decimal(10,2) default NULL,
  49. `unit` varchar(8) default NULL,
  50. `msrp` decimal(10,2) default NULL,
  51. `price` decimal(10,2) default NULL,
  52. `quantity` decimal(10,0) default NULL,
  53. `subcategory` varchar(255) default NULL,
  54. `info` varchar(255) default NULL,
  55. `giftset` tinyint(1) default NULL,
  56. `dirtiness` int(11) default NULL,
  57. `created_at` datetime default NULL,
  58. `updated_at` datetime default NULL,
  59. `nosale` tinyint(1) default '1',
  60. `orders_count` int(11) default NULL,
  61. PRIMARY KEY (`id`),
  62. KEY `index_products_on_line_id_and_orders_count` (`line_id`,`orders_count`),
  63. KEY `index_products_on_orders_count` (`orders_count`)
  64. ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  65. 1 row in set (0.00 sec)
Add Comment
Please, Sign In to add comment