View Single Post
AeroAcrobat
AlliedModders Donor
Join Date: Apr 2011
Location: lives in a circus
Old 10-14-2016 , 17:08   Re: Time Played plugin based off Dr. McKay's Player Analytics
Reply With Quote #15

I've added an index on the auth field. Query duration went from 90 seconds to 0.01 seconds.

Code:
No auth index
+------+-------------+------------------+------+---------------+------+---------+------+---------+-------------+
| id   | select_type | table            | type | possible_keys | key  |  key_len | ref  | rows    | Extra       |
+------+-------------+------------------+------+---------------+------+---------+------+---------+-------------+
|    1 | PRIMARY     | player_analytics | ALL  | NULL          | NULL |  NULL    | NULL | 5986079 | Using where |
|    2 | SUBQUERY    | player_analytics | ALL  | NULL          | NULL |  NULL    | NULL | 5986079 | Using where |
+------+-------------+------------------+------+---------------+------+---------+------+---------+-------------+

With auth index
+------+-------------+------------------+------+---------------+------+---------+-------+------+------------------------------------+
| id   | select_type | table            | type | possible_keys | key  |  key_len | ref   | rows | Extra                              |
+------+-------------+------------------+------+---------------+------+---------+-------+------+------------------------------------+
|    1 | PRIMARY     | player_analytics | ref  | auth          | auth |  99      | const |   64 | Using index condition              |
|    2 | SUBQUERY    | player_analytics | ref  | auth          | auth |  99      | const |   64 | Using index condition; Using where |
+------+-------------+------------------+------+---------------+------+---------+-------+------+------------------------------------+
__________________
AeroAcrobat is offline