pingcap / pingcap/tidb

Wrong Cost When To Use TiFlash Late Materialization

Open
#61,240 0 comments 0 reactions 0 assignees View on GitHub
affects-7.5 affects-8.1 affects-8.5 epic/cost-model severity/major sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

check TpcH Q4's cost formula.

It is known that there are 1.5 billion rows in the ```orders``` of Q4.

### 2. What did you expect to see? (Required)

### 3. What did you see instead (Required)

```
" ├─TableReader_56(Build) 56452176.33 7275819553.60 (((((cpu(1.5e+09*filters(2)*tiflash_cpu_factor(2.4))) + (((scan(1.5e+09*logrowsize(46.17)*tiflash_scan_factor(11.6))) + (scan(10000*logrowsize(46.17)*tiflash_scan_factor(11.6))))*1.00))) + (net(5.645217633333338e+07*rowsize(46.17)*tidb_flash_net_factor(2.2))))/15.00)*1.00 root MppVersion: 3, data:ExchangeSender_55",
" │ └─ExchangeSender_55 56452176.33 103403219945.10 ((cpu(1.5e+09*filters(2)*tiflash_cpu_factor(2.4))) + (((scan(1.5e+09*logrowsize(46.17)*tiflash_scan_factor(11.6))) + (scan(10000*logrowsize(46.17)*tiflash_scan_factor(11.6))))*1.00)) mpp[tiflash] ExchangeType: PassThrough",
" │ └─TableFullScan_53 56452176.33 96203219945.10 ((scan(1.5e+09*logrowsize(46.17)*tiflash_scan_factor(11.6))) + (scan(10000*logrowsize(46.17)*tiflash_scan_factor(11.6))))*1.00 mpp[tiflash] table:orders pushed down filter:ge(olap.orders.o_orderdate, 1995-01-01 00:00:00.000000), lt(olap.orders.o_orderdate, 1995-04-01 00:00:00.000000), keep order:false",
```

```ExchangeSender_55```'s formula is that

```
((cpu(1.5e+09*filters(2)*tiflash_cpu_factor(2.4)))
+
(((scan(1.5e+09*logrowsize(46.17)*tiflash_scan_factor(11.6))) + (scan(10000*logrowsize(46.17)*tiflash_scan_factor(11.6))))*1.00))
```

```TableFullScan_53```'s formula is that

```
((scan(1.5e+09*logrowsize(46.17)*tiflash_scan_factor(11.6))) + (scan(10000*logrowsize(46.17)*tiflash_scan_factor(11.6))))*1.00
```

We all know that ```ExchangeSender``` does not have a filtering mechanism. So why is there an extra ```((cpu(1.5e+09 * filters(2) * tiflash_cpu_factor(2.4))))``` ?

### 4. What is your TiDB version? (Required)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.