Skip to content

Commit cbe3168

Browse files
Fix doc wrong related with substring which can be pushed down now (pingcap#13682)
1 parent 32a4cf1 commit cbe3168

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

predicate-push-down.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ In addition, This SQL statement has an inner join executed, and the `ON` conditi
7474
### Case 4: predicates that are not supported by storage layers cannot be pushed down
7575

7676
```sql
77-
create table t(id int primary key, a int not null);
78-
desc select * from t where substring('123', a, 1) = '1';
79-
+-------------------------+---------+-----------+---------------+----------------------------------------+
80-
| id | estRows | task | access object | operator info |
81-
+-------------------------+---------+-----------+---------------+----------------------------------------+
82-
| Selection_7 | 2.00 | root | | eq(substring("123", test.t.a, 1), "1") |
83-
| └─TableReader_6 | 2.00 | root | | data:TableFullScan_5 |
84-
| └─TableFullScan_5 | 2.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
85-
+-------------------------+---------+-----------+---------------+----------------------------------------+
77+
create table t(id int primary key, a varchar(10) not null);
78+
desc select * from t where truncate(a, " ") = '1';
79+
+-------------------------+----------+-----------+---------------+---------------------------------------------------+
80+
| id | estRows | task | access object | operator info |
81+
+-------------------------+----------+-----------+---------------+---------------------------------------------------+
82+
| Selection_5 | 8000.00 | root | | eq(truncate(cast(test.t.a, double BINARY), 0), 1) |
83+
| └─TableReader_7 | 10000.00 | root | | data:TableFullScan_6 |
84+
| └─TableFullScan_6 | 10000.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
85+
+-------------------------+----------+-----------+---------------+---------------------------------------------------+
8686
```
8787

88-
In this query, there is a predicate `substring('123', a, 1) = '1'`.
88+
In this query, there is a predicate `truncate(a, " ") = '1'`.
8989

90-
From the `explain` results, we can see that the predicate is not pushed down to TiKV for calculation. This is because the TiKV coprocessor does not support the built-in function `substring`.
90+
From the `explain` results, you can see that the predicate is not pushed down to TiKV for calculation. This is because the TiKV coprocessor does not support the built-in function `truncate`.
9191

9292
### Case 5: predicates of inner tables on the outer join can't be pushed down
9393

0 commit comments

Comments
 (0)