- 论坛徽章:
- 0
|
mysql> desc UserInfoHistory_bak;
+----------------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | MUL | NULL | |
| user_name | varchar(20) | NO | | NULL | |
| user_last_login_date | datetime | NO | MUL | NULL | |
| user_password | varchar(50) | NO | MUL | NULL | |
+----------------------+-------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
mysql> explain select date(user_last_login_date) as day ,count(user_id) as userNum from UserInfoHistory_bak where date(user_last_login_date) between '2011-07-20' and '2011-07-27' and user_password!='123456' group by date(user_last_login_date);
+----+-------------+---------------------+------+---------------+------+---------+------+---------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------------+------+---------------+------+---------+------+---------+----------------------------------------------+
| 1 | SIMPLE | UserInfoHistory_bak | ALL | NULL | NULL | NULL | NULL | 3227709 | Using where; Using temporary; Using filesort |
+----+-------------+---------------------+------+---------------+------+---------+------+---------+----------------------------------------------+
1 row in set (0.00 sec)
mysql>
请帮忙看看,谢谢! |
|