Guest User

Untitled

a guest
Jun 18th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. SELECT COUNT(*) FROM (select distinct id, procname, operation, path, user, datetime from lastlogs
  2. where user = 'UNITED-TSERVER1\\Serveradmin' and datetime > '2009-5-12 08:00' and datetime < '2009-5-12 09:00') AS count_table;
  3.  
  4. +----------+
  5. | COUNT(*) |
  6. +----------+
  7. | 1064997 |
  8. +----------+
  9. 1 row in set (18 min 30.23 sec)
  10.  
  11. Az explain:
  12.  
  13. +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
  14. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  15. +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
  16. | 1 | PRIMARY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
  17. | 2 | DERIVED | lastlogs | range | user | user | 776 | NULL | 1223112 | Using where |
  18. +----+-------------+----------+-------+---------------+------+---------+------+---------+------------------------------+
  19. 2 rows in set (18 min 6.36 sec)
Add Comment
Please, Sign In to add comment