分别对三种不同引擎的表执行聚合查询,我们统计执行时间如下:
Innodb:
mysql> select count(*) from gos_so2do_statistic_innodb;
+———-+
| count(*) |
+———-+
| 10000000 |
+———-+
1 row in set (23.11 sec)
mysql> select count(server_ip) as server_ip,warehouse_id from gos_so2do_statistic_innodb group by server_ip;
+———–+————–+
| server_ip | warehouse_id |
+———–+————–+
| 1233545 | 13642 |
| 1252395 | 17459 |
| 1276362 | 1512 |
| 1215126 | 7732 |
| 1259328 | 356 |
| 1242216 | 9643 |
| 1268948 | 18286 |
| 1234421 | 3577 |
| 17659 | 3845 |
+———–+————–+
9 rows in set, 1 warning (31.62 sec)
Myisam:
mysql> select count(*) from gos_so2do_statistic_myisam;
+———-+
| count(*) |
+———-+
| 10000000 |
+———-+
1 row in set (0.00 sec)
mysql> select count(server_ip) as server_ip,warehouse_id from gos_so2do_statistic_myisam group by server_ip;
+———–+————–+
| server_ip | warehouse_id |
+———–+————–+
| 1233545 | 13642 |
| 1252395 | 17459 |
| 1276362 | 1512 |
| 1215126 | 7732 |
| 1259328 | 356 |
| 1242216 | 9643 |
| 1268948 | 18286 |
| 1234421 | 3577 |
| 17659 | 3845 |
+———–+————–+
9 rows in set, 1 warning (12.81 sec)
Brighthouse:
mysql> select count(*) from gos_so2do_statistic_brighthouse;
+———-+
| count(*) |
+———-+
| 10000000 |
+———-+
1 row in set (0.00 sec)
mysql> select count(server_ip) as server_ip,warehouse_id from gos_so2do_statistic_brighthouse group by server_ip;
+———–+————–+
| server_ip | warehouse_id |
+———–+————–+
| 1242216 | 9643 |
| 1276362 | 1512 |
| 1233545 | 13642 |
| 1259328 | 356 |
| 1252395 | 17459 |
| 1234421 | 3577 |
| 1215126 | 7732 |
| 1268948 | 18286 |
| 17659 | 3845 |
+———–+————–+
9 rows in set, 1 warning (5.30 sec)