MySQL Forums
Forum List  »  Performance

Re: How to get acceptable/repeatable performance on huge table
Posted by: Aftab Khan
Date: August 31, 2012 08:12AM

>We have good peformance with that today but it would become worse with an ordinary Uid index - don't you agree?

No, the new index would be more efficient .

Let's compare EXPLAIN output i.e. after adding secondary index and using original index:

mysql> explain select adId, count(userUId) from UserVisits where adId < 25000 group by adId;
+----+-------------+------------+-------+---------------+------+---------+------+------+--------------------------+
| id | select_type | table      | type  | possible_keys | key  | key_len | ref  | rows | Extra                    |
+----+-------------+------------+-------+---------------+------+---------+------+------+--------------------------+
|  1 | SIMPLE      | UserVisits | index | adId          | adId | 12      | NULL |    4 | Using where; Using index |
+----+-------------+------------+-------+---------------+------+---------+------+------+--------------------------+
1 row in set (0.00 sec)

mysql> explain select count(adId) from UserVisits where userUId < 25000 group by userUId;
+----+-------------+------------+-------+---------------+---------+---------+------+------+-----------------------------------------------------------+
| id | select_type | table      | type  | possible_keys | key     | key_len | ref  | rows | Extra                                                     |
+----+-------------+------------+-------+---------------+---------+---------+------+------+-----------------------------------------------------------+
|  1 | SIMPLE      | UserVisits | index | NULL          | PRIMARY | 12      | NULL |    4 | Using where; Using index; Using temporary; Using filesort |
+----+-------------+------------+-------+---------------+---------+---------+------+------+-----------------------------------------------------------+
1 row in set (0.00 sec



Edited 1 time(s). Last edit at 08/31/2012 08:16AM by Aftab Khan.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to get acceptable/repeatable performance on huge table
886
August 31, 2012 08:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.