Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. show create table users \G EXPLAIN select a.* from users as a, hands as b where a.id = b.user_id group by b.user_id order by a.created_at desc;
  2. *************************** 1. row ***************************
  3. Table: users
  4. Create Table: CREATE TABLE `users` (
  5. `id` int(11) NOT NULL AUTO_INCREMENT,
  6. `login` varchar(50) DEFAULT NULL,
  7. `email` varchar(50) DEFAULT NULL,
  8. `api_key` varchar(50) DEFAULT NULL,
  9. `facebook_uid` decimal(10,0) DEFAULT NULL,
  10. `myspace_uid` decimal(10,0) DEFAULT NULL,
  11. `admin` tinyint(4) DEFAULT '0',
  12. `avatar` varchar(50) DEFAULT 'default.jpg',
  13. `onlinetime` datetime DEFAULT NULL,
  14. `password_reset_key` varchar(50) DEFAULT NULL,
  15. `activated_at` datetime DEFAULT NULL,
  16. `activation_code` varchar(50) DEFAULT NULL,
  17. `bigbets` int(11) DEFAULT '200',
  18. `reloadint` int(11) DEFAULT '10000',
  19. `crypted_password` varchar(50) DEFAULT NULL,
  20. `salt` varchar(50) DEFAULT NULL,
  21. `twittoken` varchar(50) DEFAULT NULL,
  22. `twitsecret` varchar(50) DEFAULT NULL,
  23. `created_at` datetime DEFAULT NULL,
  24. `public` tinyint(4) DEFAULT NULL,
  25. `staked` tinyint(4) DEFAULT NULL,
  26. `shared_key` varchar(50) DEFAULT NULL,
  27. `mailings` tinyint(4) DEFAULT '1',
  28. `moderator` tinyint(4) DEFAULT '0',
  29. `viewed_alert` tinyint(4) DEFAULT '0',
  30. `epw` varchar(50) DEFAULT NULL,
  31. `mid` int(11) DEFAULT NULL,
  32. `banned` tinyint(1) DEFAULT '0',
  33. `processed` tinyint(1) DEFAULT '0',
  34. `reminded` tinyint(1) DEFAULT '0',
  35. PRIMARY KEY (`id`)
  36. ) ENGINE=InnoDB AUTO_INCREMENT=950 DEFAULT CHARSET=utf8
  37. 1 row in set (0.00 sec)
  38.  
  39. +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
  40. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  41. +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
  42. | 1 | SIMPLE | b | index | user_id | user_id | 5 | NULL | 789554 | Using index; Using temporary; Using filesort |
  43. | 1 | SIMPLE | a | eq_ref | PRIMARY | PRIMARY | 4 | bluffware_production.b.user_id | 1 | |
  44. +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
  45. 2 rows in set (0.01 sec)
  46.  
  47.  
  48. mysql> show create table hands \G;
  49. *************************** 1. row ***************************
  50. Table: hands
  51. Create Table: CREATE TABLE `hands` (
  52. `id` varchar(11) NOT NULL,
  53. `number` varchar(50) DEFAULT NULL,
  54. `is_public` tinyint(4) DEFAULT '0',
  55. `site_id` int(11) DEFAULT NULL,
  56. `tablename` char(50) DEFAULT NULL,
  57. `user_id` int(11) DEFAULT NULL,
  58. `small` int(11) DEFAULT NULL,
  59. `big` int(11) DEFAULT NULL,
  60. `ante` int(11) DEFAULT NULL,
  61. `game` varchar(50) DEFAULT NULL,
  62. `structure` varchar(50) DEFAULT NULL,
  63. `played_at` datetime DEFAULT NULL,
  64. `cards` varchar(50) DEFAULT '',
  65. `session` tinyint(4) DEFAULT NULL,
  66. `fkey` int(11) DEFAULT NULL,
  67. `net` int(11) DEFAULT '0',
  68. `visible` tinyint(4) DEFAULT '1',
  69. `viewed` int(11) DEFAULT '0',
  70. `batch_id` varchar(50) DEFAULT NULL,
  71. `created_at` datetime DEFAULT NULL,
  72. `potsize` int(11) DEFAULT '0',
  73. `winner` varchar(50) DEFAULT NULL,
  74. `sng` tinyint(4) DEFAULT '0',
  75. `scribed` tinyint(4) DEFAULT '0',
  76. `index_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  77. PRIMARY KEY (`index_id`),
  78. KEY `id` (`id`),
  79. KEY `user_id` (`user_id`)
  80. ) ENGINE=InnoDB AUTO_INCREMENT=801642 DEFAULT CHARSET=utf8
  81. 1 row in set (0.13 sec)
  82.  
  83. ERROR:
  84. No query specified
Add Comment
Please, Sign In to add comment