【 TiDB 使用环境】生产环境 or 测试环境 or POC
【 TiDB 版本】 5.1.1
【遇到的问题】
【复现路径】做过哪些操作出现的问题
【问题现象及影响】
在开启和关闭tidb_enforce_mpp参数情况下,相同的SQL语句查询结果不同,差异在于MPP的exchangesender
附上2次的explain analyze结果
tidb_enforce_mpp开启时:
±---------------------------------------±-------------±----------±------------------±--------------±---------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-----+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
±---------------------------------------±-------------±----------±------------------±--------------±---------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-----+
| StreamAgg_21 | 1.00 | 1 | root | | time:6.37s, loops:2 | funcs:count(1)->Column#199 | 8 Bytes | N/A |
| └─TableReader_97 | 0.25 | 0 | root | | time:6.37s, loops:1, cop_task: {num: 75, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_96 | N/A | N/A |
| └─ExchangeSender_96 | 0.25 | 1505976 | batchCop[tiflash] | | tiflash_task:{proc max:6.33s, min:6.11s, p80:6.33s, p95:6.33s, iters:5027, tasks:2, threads:41} | ExchangeType: PassThrough | N/A | N/A |
| └─HashJoin_92 | 0.25 | 1505976 | batchCop[tiflash] | | tiflash_task:{proc max:6.33s, min:6.11s, p80:6.33s, p95:6.33s, iters:5027, tasks:2, threads:41} | inner join, equal:[eq(table.uid, table.uid)] | N/A | N/A |
| ├─ExchangeReceiver_61(Build) | 0.25 | 7909364 | batchCop[tiflash] | | tiflash_task:{proc max:3.05s, min:2.97s, p80:3.05s, p95:3.05s, iters:370, tasks:2, threads:40} | | N/A | N/A |
| │ └─ExchangeSender_60 | 0.25 | 3954682 | batchCop[tiflash] | | tiflash_task:{proc max:3.17s, min:3.17s, p80:3.17s, p95:3.17s, iters:4962, tasks:2, threads:42} | ExchangeType: Broadcast | N/A | N/A |
| │ └─Selection_59 | 0.25 | 3954682 | batchCop[tiflash] | | tiflash_task:{proc max:3.17s, min:3.17s, p80:3.17s, p95:3.17s, iters:4962, tasks:2, threads:42} | eq(table.localcountryid, 1), eq(table.message_locale, “zh-hk”), eq(table.upload_crm, 1) | N/A | N/A |
| │ └─TableFullScan_58 | 248870959.00 | 250941738 | batchCop[tiflash] | table:t1 | tiflash_task:{proc max:2.77s, min:2.77s, p80:2.77s, p95:2.77s, iters:5010, tasks:2, threads:42} | keep order:false, stats:pseudo | N/A | N/A |
| └─Selection_63(Probe) | 221052.47 | 60357517 | batchCop[tiflash] | | tiflash_task:{proc max:2.79s, min:2.61s, p80:2.79s, p95:2.79s, iters:5027, tasks:2, threads:41} | eq(table.upload_crm, 1), or(ne(table.message_locale, “zh-hk”), ne(table.localprovinceid, 32)) | N/A | N/A |
| └─TableFullScan_62 | 248870959.00 | 251293130 | batchCop[tiflash] | table:t1 | tiflash_task:{proc max:2.18s, min:2.05s, p80:2.18s, p95:2.18s, iters:5031, tasks:2, threads:41} | keep order:false, stats:pseudo | N/A | N/A |
±---------------------------------------±-------------±----------±------------------±--------------±---------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±--------±-----+
tidb_enforce_mpp关闭时:
±-------------------------------±-------------±----------±------------------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±---------±--------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
±-------------------------------±-------------±----------±------------------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±---------±--------+
| StreamAgg_20 | 1.00 | 1 | root | | time:11.3s, loops:2 | funcs:count(1)->Column#199 | 8 Bytes | N/A |
| └─HashJoin_26 | 0.25 | 1505968 | root | | time:11.2s, loops:1475, build_hash_table:{total:4.94s, fetch:2.04s, build:2.91s}, probe:{concurrency:5, total:56.5s, max:11.3s, probe:29.5s, fetch:27s} | inner join, equal:[eq(table.uid, table.uid)] | 248.2 MB | 0 Bytes |
| ├─TableReader_37(Build) | 0.25 | 3954661 | root | | time:2.24s, loops:5111, cop_task: {num: 1877, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00} | data:Selection_36 | 1.12 MB | N/A |
| │ └─Selection_36 | 0.25 | 3954661 | batchCop[tiflash] | | tiflash_task:{proc max:4.91s, min:3.93s, p80:4.91s, p95:4.91s, iters:4969, tasks:2, threads:40} | eq(table.localcountryid, 1), eq(table.message_locale, “zh-hk”), eq(table.upload_crm, 1) | N/A | N/A |
| │ └─TableFullScan_35 | 248872880.00 | 251855024 | batchCop[tiflash] | table:t1 | tiflash_task:{proc max:4.19s, min:3.4s, p80:4.19s, p95:4.19s, iters:5011, tasks:2, threads:40} | keep order:false, stats:pseudo | N/A | N/A |
| └─TableReader_40(Probe) | 221054.17 | 60358891 | root | | time:708.9ms, loops:61330, cop_task: {num: 4752, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00} | data:Selection_39 | 3.27 MB | N/A |
| └─Selection_39 | 221054.17 | 60358891 | batchCop[tiflash] | | tiflash_task:{proc max:4.88s, min:3.68s, p80:4.88s, p95:4.88s, iters:4997, tasks:2, threads:40} | eq(table.upload_crm, 1), or(ne(table.message_locale, “zh-hk”), ne(table.localprovinceid, 32)) | N/A | N/A |
| └─TableFullScan_38 | 248872880.00 | 250879447 | batchCop[tiflash] | table:t1 | tiflash_task:{proc max:3.88s, min:2.86s, p80:3.88s, p95:3.88s, iters:4999, tasks:2, threads:40} | keep order:false, stats:pseudo | N/A | N/A |
±-------------------------------±-------------±----------±------------------±--------------±--------------------------------------------------------------------------------------------------------------------------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------±---------±--------+
【附件】 相关日志及监控(https://metricstool.pingcap.com/)
若提问为性能优化、故障排查类问题,请下载脚本运行。终端输出的打印结果,请务必全选并复制粘贴上传。