Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- *************************** 1. row ***************************
- Table: users
- Create Table: CREATE TABLE `users` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `login` varchar(50) DEFAULT NULL,
- `email` varchar(50) DEFAULT NULL,
- `api_key` varchar(50) DEFAULT NULL,
- `facebook_uid` decimal(10,0) DEFAULT NULL,
- `myspace_uid` decimal(10,0) DEFAULT NULL,
- `admin` tinyint(4) DEFAULT '0',
- `avatar` varchar(50) DEFAULT 'default.jpg',
- `onlinetime` datetime DEFAULT NULL,
- `password_reset_key` varchar(50) DEFAULT NULL,
- `activated_at` datetime DEFAULT NULL,
- `activation_code` varchar(50) DEFAULT NULL,
- `bigbets` int(11) DEFAULT '200',
- `reloadint` int(11) DEFAULT '10000',
- `crypted_password` varchar(50) DEFAULT NULL,
- `salt` varchar(50) DEFAULT NULL,
- `twittoken` varchar(50) DEFAULT NULL,
- `twitsecret` varchar(50) DEFAULT NULL,
- `created_at` datetime DEFAULT NULL,
- `public` tinyint(4) DEFAULT NULL,
- `staked` tinyint(4) DEFAULT NULL,
- `shared_key` varchar(50) DEFAULT NULL,
- `mailings` tinyint(4) DEFAULT '1',
- `moderator` tinyint(4) DEFAULT '0',
- `viewed_alert` tinyint(4) DEFAULT '0',
- `epw` varchar(50) DEFAULT NULL,
- `mid` int(11) DEFAULT NULL,
- `banned` tinyint(1) DEFAULT '0',
- `processed` tinyint(1) DEFAULT '0',
- `reminded` tinyint(1) DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=950 DEFAULT CHARSET=utf8
- 1 row in set (0.00 sec)
- +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
- | 1 | SIMPLE | b | index | user_id | user_id | 5 | NULL | 789554 | Using index; Using temporary; Using filesort |
- | 1 | SIMPLE | a | eq_ref | PRIMARY | PRIMARY | 4 | bluffware_production.b.user_id | 1 | |
- +----+-------------+-------+--------+---------------+---------+---------+--------------------------------+--------+----------------------------------------------+
- 2 rows in set (0.01 sec)
- mysql> show create table hands \G;
- *************************** 1. row ***************************
- Table: hands
- Create Table: CREATE TABLE `hands` (
- `id` varchar(11) NOT NULL,
- `number` varchar(50) DEFAULT NULL,
- `is_public` tinyint(4) DEFAULT '0',
- `site_id` int(11) DEFAULT NULL,
- `tablename` char(50) DEFAULT NULL,
- `user_id` int(11) DEFAULT NULL,
- `small` int(11) DEFAULT NULL,
- `big` int(11) DEFAULT NULL,
- `ante` int(11) DEFAULT NULL,
- `game` varchar(50) DEFAULT NULL,
- `structure` varchar(50) DEFAULT NULL,
- `played_at` datetime DEFAULT NULL,
- `cards` varchar(50) DEFAULT '',
- `session` tinyint(4) DEFAULT NULL,
- `fkey` int(11) DEFAULT NULL,
- `net` int(11) DEFAULT '0',
- `visible` tinyint(4) DEFAULT '1',
- `viewed` int(11) DEFAULT '0',
- `batch_id` varchar(50) DEFAULT NULL,
- `created_at` datetime DEFAULT NULL,
- `potsize` int(11) DEFAULT '0',
- `winner` varchar(50) DEFAULT NULL,
- `sng` tinyint(4) DEFAULT '0',
- `scribed` tinyint(4) DEFAULT '0',
- `index_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`index_id`),
- KEY `id` (`id`),
- KEY `user_id` (`user_id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=801642 DEFAULT CHARSET=utf8
- 1 row in set (0.13 sec)
- ERROR:
- No query specified
Add Comment
Please, Sign In to add comment