I. User table information
Ii. Conclusion
Use the query statement: Select count (1) from user; Use the explain statement to check whether the statement is indexed. the following result shows the query time of the statement.
Data Volume query time (unit: seconds)
386781 0.17
609341 0.27
612181 0.25
638021 0.27
670821 0.28
788461 0.34
795261 0.35
800501 0.34
821741 0.35
902421 0.66
911181 1.70
917661 1.71
920421 1.58
927501 1.61
953181 1.73
991821 1.96
995701 1.77
997341 2.04
1188461 1.18
1588461 1.64
1588461 1.68
1874461 3.04
1897861 3.57
1903161 3.23
2001561 3.11
2124361 3.49
2588461 2.78
3088461 2.99
Iii. MySQL query time records
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 386781 |
+ ---------- +
1 row in SET (0.17 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 609341 |
+ ---------- +
1 row in SET (0.27 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 612181 |
+ ---------- +
1 row in SET (0.25 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 613221 |
+ ---------- +
1 row in SET (0.26 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 615021 |
+ ---------- +
1 row in SET (0.26 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 616141 |
+ ---------- +
1 row in SET (0.26 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 633461 |
+ ---------- +
1 row in SET (0.27 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 634981 |
+ ---------- +
1 row in SET (0.27 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 638021 |
+ ---------- +
1 row in SET (0.27 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 670821 |
+ ---------- +
1 row in SET (0.28 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 788461 |
+ ---------- +
1 row in SET (0.34 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 795261 |
+ ---------- +
1 row in SET (0.35 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 797461 |
+ ---------- +
1 row in SET (0.33 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 799301 |
+ ---------- +
1 row in SET (0.34 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 800501 |
+ ---------- +
1 row in SET (0.34 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 801581 |
+ ---------- +
1 row in SET (0.33 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 802421 |
+ ---------- +
1 row in SET (0.34 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 803221 |
+ ---------- +
1 row in SET (0.34 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 821741 |
+ ---------- +
1 row in SET (0.35 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 902421 |
+ ---------- +
1 row in SET (0.66 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 908661 |
+ ---------- +
1 row in SET (1.62 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 911181 |
+ ---------- +
1 row in SET (1.70 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 916341 |
+ ---------- +
1 row in SET (1.86 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 917661 |
+ ---------- +
1 row in SET (1.71 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 920421 |
+ ---------- +
1 row in SET (1.58 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 922061 |
+ ---------- +
1 row in SET (1.66 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 923741 |
+ ---------- +
1 row in SET (2.05 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 925861 |
+ ---------- +
1 row in SET (1.64 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 927501 |
+ ---------- +
1 row in SET (1.61 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 953181 |
+ ---------- +
1 row in SET (1.73 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 991821 |
+ ---------- +
1 row in SET (1.96 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 994261 |
+ ---------- +
1 row in SET (1.69 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 995701 |
+ ---------- +
1 row in SET (1.77 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 997341 |
+ ---------- +
1 row in SET (2.04 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 999581 |
+ ---------- +
1 row in SET (1.81 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1001661 |
+ ---------- +
1 row in SET (1.80 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1004261 |
+ ---------- +
1 row in SET (1.81 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1006701 |
+ ---------- +
1 row in SET (1.85 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1188461 |
+ ---------- +
1 row in SET (1.18 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1188461 |
+ ---------- +
1 row in SET (1.31 Sec)
Mysql> explain select count (1) from user;
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| ID | select_type | table | type | possible_keys | key | key_len | ref |
Rows | extra |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| 1 | simple | user | index | null | primary | 8 | null |
1188729 | using index |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
1 row in SET (0.03 Sec)
Mysql> explain select count (1) from user;
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| ID | select_type | table | type | possible_keys | key | key_len | ref |
Rows | extra |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| 1 | simple | user | index | null | primary | 8 | null |
1188729 | using index |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
1 row in SET (0.00 Sec)
Mysql> explain select count (1) from user;
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| ID | select_type | table | type | possible_keys | key | key_len | ref |
Rows | extra |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| 1 | simple | user | index | null | primary | 8 | null |
1188729 | using index |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
1 row in SET (0.00 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 1188461 |
+ ---------- +
1 row in SET (1.20 Sec)
Mysql> explain select * from user limit 100000,10;
+ ---- + ------------- + ------- + ------ + --------------- + ------ + --------- + ------ + -----
---- + ------- +
| ID | select_type | table | type | possible_keys | key | key_len | ref | rows
| Extra |
+ ---- + ------------- + ------- + ------ + --------------- + ------ + --------- + ------ + -----
---- + ------- +
| 1 | simple | user | all | null | 1188
729 |
+ ---- + ------------- + ------- + ------ + --------------- + ------ + --------- + ------ + -----
---- + ------- +
1 row in SET (0.00 Sec)
Mysql> explain select count (*) from user;
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| ID | select_type | table | type | possible_keys | key | key_len | ref |
Rows | extra |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
| 1 | simple | user | index | null | primary | 8 | null |
1188729 | using index |
+ ---- + ------------- + ------- + --------------- + --------- + ------ +-
-------- + ------------- +
1 row in SET (0.00 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1188461 |
+ ---------- +
1 row in SET (1.23 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1588461 |
+ ---------- +
1 row in SET (1.64 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1588461 |
+ ---------- +
1 row in SET (1.68 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1588461 |
+ ---------- +
1 row in SET (1.56 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1874461 |
+ ---------- +
1 row in SET (3.04 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1897861 |
+ ---------- +
1 row in SET (3.57 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 1903161 |
+ ---------- +
1 row in SET (3.23 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2001561 |
+ ---------- +
1 row in SET (3.11 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2124361 |
+ ---------- +
1 row in SET (3.49 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2324761 |
+ ---------- +
1 row in SET (4.03 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2588461 |
+ ---------- +
1 row in SET (2.78 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2588461 |
+ ---------- +
1 row in SET (3.09 Sec)
Mysql> select count (*) from user;
+ ---------- +
| Count (*) |
+ ---------- +
| 1, 2588461 |
+ ---------- +
1 row in SET (2.95 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 2588461 |
+ ---------- +
1 row in SET (2.44 Sec)
Mysql> select count (1) from user;
+ ---------- +
| Count (1) |
+ ---------- +
| 1, 2588461 |
+ ---------- +
1 row in SET (2.41 Sec)