获得执行计划后能够看到表之间的关联关系。
截取部分信息如下所示:
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t4 359712959 1799989120 359712959 2432:33.37 2
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 359712959 4693364 2435:09.61 2753412
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t5 54564896 68238136 54564896 1183:09.90 1
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 54564896 711570 1628:58.17 8698476
type table rows_prod est_rows rows_scan time est_cost
-------------------------------------------------------------------
scan t6 2182271 45000000 54564896 22:19.50 1
type rows_prod est_rows time est_cost
-------------------------------------------------
nljoin 2182271 28463 1630:48.99 10363743
type rows_prod est_rows rows_cons time est_cost
------------------------------------------------------------
group 9 25 2182271 815:28.37 57707
type rows_prod est_rows rows_cons time
-------------------------------------------------
group 5 25 9 407:44.18
type rows_sort est_rows rows_cons time est_cost
------------------------------------------------------------
sort 5 25 5 407:44.18 4
实际结果的执行时间为407:44.18。执行计划前面部分,表的关系为嵌套并且都走了索引。
问题:
1.嵌套时间1628:58.17肯定是不准备的,这时间如何计算出来,又如何知道真实的执行时间?
2.rows_prod代表什么意思,与est_rows 和rows_scan的值相差较大,又说明什么?
3. 统计信息刚执行完,为什么est_rows与rows_scan相差较大?
4.scan t5 的cost的值为1扫描行数很多,为何值这么小,且为1是因为全部内存scan么?
5.综上信息能看出这条sql具体慢在哪里?
收起