tidb执行计划--一

mysql> desc select a.name,a.age from student a inner join student2 b on a.age=b.age where a.age < 30;
+-----------------------------+-----------+-----------+-----------------------------+-------------------------------------------------------------+
| id                          | estRows   | task      | access object               | operator info                                               |
+-----------------------------+-----------+-----------+-----------------------------+-------------------------------------------------------------+
| HashJoin_23                 | 29029.00  | root      |                             | inner join, equal:[eq(test.student2.age, test.student.age)] |
| ├─IndexReader_28(Build)     | 29029.00  | root      |                             | index:IndexRangeScan_27                                     |
| │ └─IndexRangeScan_27       | 29029.00  | cop[tikv] | table:b, index:idx_age(age) | range:[-inf,30), keep order:false                           |
| └─TableReader_26(Probe)     | 33294.82  | root      |                             | data:Selection_25                                           |
|   └─Selection_25            | 33294.82  | cop[tikv] |                             | lt(test.student.age, 30), not(isnull(test.student.age))     |
|     └─TableFullScan_24      | 100185.00 | cop[tikv] | table:a                     | keep order:false                                            |
+-----------------------------+-----------+-----------+-----------------------------+-------------------------------------------------------------+
6 rows in set (0.00 sec)
  • id: 算子_id 组成,不同的算子表示不同的含义; id是唯一的;
  • estRows: 根据统计信息估算的扫描行数;
  • task:算子属于task的种类, root task表示在tidb server中执行的算子, cop[tikv]表示在tikv节点执行的算子, cop[tiflash]表示在tiflash执行的算子;
  • access object:算子所访问的数据想信息,包括表table,表分区partition,和使用的索引index;只有直接访问数据的算子才有这些信息
  • operator info:  算子的其他描述信息, 如lt(test.student.age,30)表示过滤less than 小于等于 student 表age字段30的数据;

EXPLAIN ANALYZE ...

mysql> explain analyze select a.name,a.age from student a inner join student2 b on a.age=b.age where a.age < 30\G
*************************** 1. row ***************************
            id: HashJoin_21
       estRows: 29029.00
       actRows: 58058
          task: root
 access object: 
execution info: time:12ms, loops:58, build_hash_table:{total:1.17ms, fetch:1.14ms, build:31.8µs}, probe:{concurrency:5, total:57.9ms, max:11.9ms, probe:50.3ms, fetch:7.57ms}
 operator info: inner join, equal:[eq(test.student.age, test.student2.age)]
        memory: 24.5 KB
          disk: 0 Bytes
*************************** 2. row ***************************
            id: ├─TableReader_24(Build)
       estRows: 25654.88
       actRows: 58
          task: root
 access object: 
execution info: time:1.07ms, loops:2, cop_task: {num: 1, max: 1.22ms, proc_keys: 0, rpc_num: 1, rpc_time: 1.19ms, copr_cache_hit_ratio: 1.00}
 operator info: data:Selection_23
        memory: 2.09 KB
          disk: N/A
*************************** 3. row ***************************
            id: │ └─Selection_23
       estRows: 25654.88
       actRows: 58
          task: cop[tikv]
 access object: 
execution info: tikv_task:{time:110ms, loops:102}
 operator info: lt(test.student.age, 30), not(isnull(test.student.age))
        memory: N/A
          disk: N/A
*************************** 4. row ***************************
            id: │   └─TableFullScan_22
       estRows: 100185.00
       actRows: 100098
          task: cop[tikv]
 access object: table:a
execution info: tikv_task:{time:104ms, loops:102}
 operator info: keep order:false
        memory: N/A
          disk: N/A
*************************** 5. row ***************************
            id: └─IndexReader_26(Probe)
       estRows: 29029.00
       actRows: 29029
          task: root
 access object: 
execution info: time:1.47ms, loops:30, cop_task: {num: 1, max: 1.12ms, proc_keys: 0, rpc_num: 1, rpc_time: 1.1ms, copr_cache_hit_ratio: 1.00}
 operator info: index:IndexRangeScan_25
        memory: 227.4 KB
          disk: N/A
*************************** 6. row ***************************
            id:   └─IndexRangeScan_25
       estRows: 29029.00
       actRows: 29029
          task: cop[tikv]
 access object: table:b, index:idx_age(age)
execution info: tikv_task:{time:30ms, loops:33}
 operator info: range:[-inf,30), keep order:false
        memory: N/A
          disk: N/A
6 rows in set (0.02 sec)
  • estRows: 根据统计信息预估的行数;
  • actRows: 实际执行扫描的行数
  • execution info:算子实际执行信息,time表示算子实际执行时间;如果该算子被多次调用loops,这个时间就是累计时间; loops表示调用次数;
  • memory : 算子占用内存空间大小
  • disk: 算子占用磁盘空间大小

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值