Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT COUNT(*) FROM (select distinct id, procname, operation, path, user, datetime from lastlogs
- where user = 'UNITED-TSERVER1\\Serveradmin' and datetime > '2009-5-12 08:00' and datetime < '2009-5-12 09:00') AS count_table;
- +----------+
- | COUNT(*) |
- +----------+
- | 1064997 |
- +----------+
- 1 row in set (18 min 30.23 sec)
- Az explain:
- +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
- | 1 | PRIMARY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
- | 2 | DERIVED | lastlogs | range | user | user | 776 | NULL | 1223112 | Using where |
- +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
- 2 rows in set (18 min 6.36 sec)
Add Comment
Please, Sign In to add comment