MySQL Forums
Forum List  »  Partitioning

Re: I divided table on two parts, but MySQL scanning full table
Posted by: Rick James
Date: February 11, 2012 12:04AM

As an example:
mysql> SHOW SESSION STATUS LIKE 'Handler_read%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Handler_read_first    | 0     |
| Handler_read_key      | 1     |
| Handler_read_next     | 0     |
| Handler_read_prev     | 0     |
| Handler_read_rnd      | 0     |
| Handler_read_rnd_next | 0     |
+-----------------------+-------+
6 rows in set (0.20 sec)

mysql> SELECT COUNT(*) FROM us;
+----------+
| COUNT(*) |
+----------+
|     4175 |
+----------+
1 row in set (0.44 sec)

mysql> SHOW SESSION STATUS LIKE 'Handler_read%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Handler_read_first    | 1     | diff = 1
| Handler_read_key      | 3     | diff = 2
| Handler_read_next     | 4175  | diff = 4175
| Handler_read_prev     | 0     |
| Handler_read_rnd      | 0     |
| Handler_read_rnd_next | 0     |
+-----------------------+-------+
6 rows in set (0.08 sec)

I can't explain the 1 and 2. But clearly it needed to scan through 4175 items (Handler_read_next) to get the answer (COUNT(*)).

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: I divided table on two parts, but MySQL scanning full table
1771
February 11, 2012 12:04AM


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.