- 论坛徽章:
- 1
|
EXPLAIN一下的结果:
+----+-------------+-------+-------+--------------------------------+------------+---------+--------------------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+--------------------------------+------------+---------+--------------------+------+--------------------------+
| 1 | SIMPLE | br | range | PRIMARY,ntime | ntime | 9 | NULL | 135 | Using where; Using index |
| 1 | SIMPLE | cc | ref | x_cc_block | x_cc_block | 7 | abenew.br.block_id | 1 | Using where |
| 1 | SIMPLE | bt | ref | PRIMARY,block_id,x_block_tx_tx | PRIMARY | 7 | abenew.br.block_id | 4 | Using where; Using index |
| 1 | SIMPLE | txout | ref | tx_id,x_txout_pubkey | tx_id | 12 | abenew.bt.tx_id | 1 | Using where |
+----+-------------+-------+-------+--------------------------------+------------+---------+--------------------+------+--------------------------+
几乎都耗时在sending data过程中, 查询都采用了index, 这一般会是什么问题。
mysql> show profile for query 1;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000043 |
| checking query cache for query | 0.000113 |
| Opening tables | 0.000031 |
| System lock | 0.000010 |
| Table lock | 0.000073 |
| init | 0.000045 |
| optimizing | 0.000023 |
| statistics | 0.000806 |
| preparing | 0.000030 |
| executing | 0.000011 |
| Sending data | 1.973856 |
| end | 0.000016 |
| query end | 0.000007 |
| freeing items | 0.000045 |
| storing result in query cache | 0.000010 |
| logging slow query | 0.000004 |
| cleaning up | 0.000007 |
+--------------------------------+----------+
17 rows in set (0.00 sec) |
|