已经重新上传,麻烦帮忙分析,谢谢
mysql> EXPLAIN ANALYZE select collection_id, SUM( CASE when projectName like '所有者%合计%' or projectName like '净资产%' THEN cast(replace(endBalance,',','') as decimal) ELSE 0 END) as equity from tax_balance_sheet_record_item GROUP BY collection_id HAVING collection_id='9ead706a6ee03bd6c548480abc351b8d';
+------------------------------------+---------+---------+-----------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
+------------------------------------+---------+---------+-----------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------+
| Projection_5 | 1.10 | 1 | root | | time:2.32ms, loops:2, Concurrency:OFF | data_lake.tax_balance_sheet_record_item.collection_id, Column#10 | 2.01 KB | N/A |
| └─HashAgg_22 | 1.10 | 1 | root | | time:2.31ms, loops:2, partial_worker:{wall_time:2.256081ms, concurrency:5, task_num:1, tot_wait:10.819646ms, tot_exec:18.523µs, tot_time:10.849151ms, max:2.192575ms, p95:2.192575ms}, final_worker:{wall_time:2.300285ms, concurrency:5, task_num:1, tot_wait:11.063453ms, tot_exec:29.535µs, tot_time:11.095601ms, max:2.236367ms, p95:2.236367ms} | group by:data_lake.tax_balance_sheet_record_item.collection_id, funcs:sum(Column#14)->Column#10, funcs:firstrow(data_lake.tax_balance_sheet_record_item.collection_id)->data_lake.tax_balance_sheet_record_item.collection_id | 24.2 KB | N/A |
| └─IndexLookUp_23 | 1.10 | 1 | root | | time:2.18ms, loops:2, index_task: {total_time: 1.09ms, fetch_handle: 1.08ms, build: 861ns, wait: 5.79µs}, table_task: {total_time: 6.93ms, num: 1, concurrency: 5} | | 10.8 KB | N/A |
| ├─IndexRangeScan_20(Build) | 79.53 | 53 | cop[tikv] | table:tax_balance_sheet_record_item, index:idx_collection_id(collection_id) | time:1.07ms, loops:3, cop_task: {num: 1, max: 993.1µs, proc_keys: 53, rpc_num: 1, rpc_time: 979.1µs, copr_cache_hit_ratio: 0.00}, tikv_task:{time:0s, loops:2}, scan_detail: {total_process_keys: 53, total_keys: 54, rocksdb: {delete_skipped_count: 0, key_skipped_count: 53, block: {cache_hit_count: 13, read_count: 0, read_byte: 0 Bytes}}} | range:["9ead706a6ee03bd6c548480abc351b8d","9ead706a6ee03bd6c548480abc351b8d"], keep order:false | N/A | N/A |
| └─HashAgg_7(Probe) | 1.10 | 1 | cop[tikv] | | time:847.2µs, loops:2, cop_task: {num: 1, max: 761.2µs, proc_keys: 0, rpc_num: 1, rpc_time: 751.5µs, copr_cache_hit_ratio: 1.00}, tikv_task:{time:13ms, loops:1} | group by:data_lake.tax_balance_sheet_record_item.collection_id, funcs:sum(case(or(like(data_lake.tax_balance_sheet_record_item.projectname, "所有者%合计%", 92), like(data_lake.tax_balance_sheet_record_item.projectname, "净资产%", 92)), cast(replace(data_lake.tax_balance_sheet_record_item.endbalance, ",", ""), decimal(10,0) BINARY), 0))->Column#14 | N/A | N/A |
| └─TableRowIDScan_21 | 79.53 | 53 | cop[tikv] | table:tax_balance_sheet_record_item | tikv_task:{time:7ms, loops:1} | keep order:false | N/A | N/A |
+------------------------------------+---------+---------+-----------+-----------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------+
6 rows in set (0.03 sec)
mysql> EXPLAIN ANALYZE select collection_id, SUM( CASE when projectName like '所有者%合计%' or projectName like '净资产%' THEN cast(replace(endBalance,',','') as decimal) ELSE 0 END) as equity from tax_balance_sheet_record_item GROUP BY collection_id ;
+----------------------------------------+--------------+-----------+-------------------+-------------------------------------+---------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+
| id | estRows | actRows | task | access object | execution info | operator info | memory | disk |
+----------------------------------------+--------------+-----------+-------------------+-------------------------------------+---------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+
| Projection_4 | 1875637.08 | 1884317 | root | | time:1m50.1s, loops:1879, Concurrency:5 | data_lake.tax_balance_sheet_record_item.collection_id, Column#10 | 805.9 KB | N/A |
| └─TableReader_33 | 1875637.08 | 1884317 | root | | time:1m50.1s, loops:1879, cop_task: {num: 87, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_32 | N/A | N/A |
| └─ExchangeSender_32 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.8s, loops:256, threads:1} | ExchangeType: PassThrough | N/A | N/A |
| └─Projection_28 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.8s, loops:256, threads:1} | Column#10, data_lake.tax_balance_sheet_record_item.collection_id | N/A | N/A |
| └─HashAgg_29 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.8s, loops:256, threads:1} | group by:data_lake.tax_balance_sheet_record_item.collection_id, funcs:sum(Column#13)->Column#10, funcs:firstrow(data_lake.tax_balance_sheet_record_item.collection_id)->data_lake.tax_balance_sheet_record_item.collection_id | N/A | N/A |
| └─ExchangeReceiver_31 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.7s, loops:86, threads:32} | | N/A | N/A |
| └─ExchangeSender_30 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.5s, loops:256, threads:32} | ExchangeType: HashPartition, Hash Cols: data_lake.tax_balance_sheet_record_item.collection_id | N/A | N/A |
| └─HashAgg_9 | 1875637.08 | 1884317 | batchCop[tiflash] | | tiflash_task:{time:1m48.5s, loops:256, threads:1} | group by:Column#20, funcs:sum(Column#19)->Column#13 | N/A | N/A |
| └─Projection_41 | 108652949.00 | 108644706 | batchCop[tiflash] | | tiflash_task:{time:1m48.1s, loops:1857, threads:32} | case(or(like(data_lake.tax_balance_sheet_record_item.projectname, 所有者%合计%, 92), like(data_lake.tax_balance_sheet_record_item.projectname, 净资产%, 92)), cast(replace(data_lake.tax_balance_sheet_record_item.endbalance, ,, ), decimal(10,0) BINARY), 0)->Column#19, data_lake.tax_balance_sheet_record_item.collection_id | N/A | N/A |
| └─TableFullScan_27 | 108652949.00 | 108644706 | batchCop[tiflash] | table:tax_balance_sheet_record_item | tiflash_task:{time:1.15s, loops:1857, threads:32} | keep order:false | N/A | N/A |
+----------------------------------------+--------------+-----------+-------------------+-------------------------------------+---------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+
10 rows in set (110.25 sec)```