表中有200W条数据, 索引情况 Table: tblAlarm
Non_unique: 1
Key_name: tblAlarm_OccurTime
Seq_in_index: 1
Column_name: OccurTime
Collation: A
Cardinality: 435583
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment: select * from tblAlarm order by OccurTime desc limit 1, 100;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000023 |
| checking query cache for query | 0.000060 |
| Opening tables | 0.000201 |
| System lock | 0.000004 |
| Table lock | 0.000013 |
| init | 0.000021 |
| optimizing | 0.000004 |
| statistics | 0.000009 |
| preparing | 0.000009 |
| executing | 0.000003 |
| Sorting result | 0.000006 |
| Sending data | 0.001417 |
| end | 0.000005 |
| query end | 0.000003 |
| freeing items | 0.000027 |
| storing result in query cache | 0.000005 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------------------+----------+select * from tblAlarm order by OccurTime desc limit 2000000, 100;
+--------------------------------+-----------+
| Status | Duration |
+--------------------------------+-----------+
| starting | 0.000019 |
| checking query cache for query | 0.000049 |
| Opening tables | 0.000012 |
| System lock | 0.000006 |
| Table lock | 0.000018 |
| init | 0.000022 |
| optimizing | 0.000005 |
| statistics | 0.000010 |
| preparing | 0.000008 |
| executing | 0.000003 |
| Sorting result | 3.172254 |
| Sending data | 18.321512 |
| end | 0.000019 |
| query end | 0.000005 |
| freeing items | 0.000074 |
| storing result in query cache | 0.000009 |
| logging slow query | 0.000003 |
| logging slow query | 0.000002 |
| cleaning up | 0.000005 | 表引擎为 MyIsam 数据库版本 5.1.37有人知道这是为什么么,或者,,有什么好办法可以减少Sending data这部分的开销?
Non_unique: 1
Key_name: tblAlarm_OccurTime
Seq_in_index: 1
Column_name: OccurTime
Collation: A
Cardinality: 435583
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment: select * from tblAlarm order by OccurTime desc limit 1, 100;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000023 |
| checking query cache for query | 0.000060 |
| Opening tables | 0.000201 |
| System lock | 0.000004 |
| Table lock | 0.000013 |
| init | 0.000021 |
| optimizing | 0.000004 |
| statistics | 0.000009 |
| preparing | 0.000009 |
| executing | 0.000003 |
| Sorting result | 0.000006 |
| Sending data | 0.001417 |
| end | 0.000005 |
| query end | 0.000003 |
| freeing items | 0.000027 |
| storing result in query cache | 0.000005 |
| logging slow query | 0.000002 |
| cleaning up | 0.000004 |
+--------------------------------+----------+select * from tblAlarm order by OccurTime desc limit 2000000, 100;
+--------------------------------+-----------+
| Status | Duration |
+--------------------------------+-----------+
| starting | 0.000019 |
| checking query cache for query | 0.000049 |
| Opening tables | 0.000012 |
| System lock | 0.000006 |
| Table lock | 0.000018 |
| init | 0.000022 |
| optimizing | 0.000005 |
| statistics | 0.000010 |
| preparing | 0.000008 |
| executing | 0.000003 |
| Sorting result | 3.172254 |
| Sending data | 18.321512 |
| end | 0.000019 |
| query end | 0.000005 |
| freeing items | 0.000074 |
| storing result in query cache | 0.000009 |
| logging slow query | 0.000003 |
| logging slow query | 0.000002 |
| cleaning up | 0.000005 | 表引擎为 MyIsam 数据库版本 5.1.37有人知道这是为什么么,或者,,有什么好办法可以减少Sending data这部分的开销?
这种情况肯定要取2000100条数据 然后取最后100条