-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into wrj/correlated-subquery
Signed-off-by: Runji Wang <[email protected]>
- Loading branch information
Showing
9 changed files
with
313 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
-- use merge join for primary key joins | ||
explain select * from t1 join t2 on a = c; | ||
|
||
/* | ||
Join { type: inner, on: = { lhs: c, rhs: a }, cost: 0, rows: 0 } | ||
├── Scan { table: t1, list: [ a, b ], filter: true, cost: 0, rows: 0 } | ||
└── Scan { table: t2, list: [ c, d ], filter: true, cost: 0, rows: 0 } | ||
*/ | ||
|
||
-- use storage order by instead of sorting by primary key | ||
explain select * from t1 order by a; | ||
|
||
/* | ||
Scan { table: t1, list: [ a, b ], filter: true, cost: 0, rows: 0 } | ||
*/ | ||
|
||
-- use storage filter for primary key | ||
explain select * from t1 where a = 1; | ||
|
||
/* | ||
Scan { table: t1, list: [ a, b ], filter: = { lhs: a, rhs: 1 }, cost: 10, rows: 5 } | ||
*/ | ||
|
||
-- use storage filter for a combination of primary key and other keys | ||
explain select * from t1 where a > 1 and a < 3 and b > 1; | ||
|
||
/* | ||
Filter { cond: > { lhs: b, rhs: 1 }, cost: 16.05, rows: 2.5 } | ||
└── Scan | ||
├── table: t1 | ||
├── list: [ a, b ] | ||
├── filter: and { lhs: > { lhs: 3, rhs: a }, rhs: > { lhs: a, rhs: 1 } } | ||
├── cost: 10 | ||
└── rows: 5 | ||
*/ | ||
|
||
-- use storage filter for a combination of primary key (always false) and other keys | ||
explain select * from t1 where a > 1 and a < 0 and b > 1; | ||
|
||
/* | ||
Scan { table: t1, list: [ a, b ], filter: false, cost: 10, rows: 5 } | ||
*/ | ||
|
||
-- use storage filter for a combination of primary key (could be eliminated) and other keys | ||
explain select * from t1 where a > 1 and a > 3 and b > 1; | ||
|
||
/* | ||
Filter { cond: and { lhs: > { lhs: a, rhs: 3 }, rhs: > { lhs: b, rhs: 1 } }, cost: 15.1, rows: 1.25 } | ||
└── Scan { table: t1, list: [ a, b ], filter: > { lhs: a, rhs: 1 }, cost: 10, rows: 5 } | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
- sql: | | ||
explain select * from t1 join t2 on a = c; | ||
desc: use merge join for primary key joins | ||
before: | ||
- create table t1(a int primary key, b int); | ||
create table t2(c int primary key, d int); | ||
tasks: | ||
- sql: | | ||
explain select * from t1 order by a; | ||
desc: use storage order by instead of sorting by primary key | ||
before: | ||
- create table t1(a int primary key, b int); | ||
tasks: | ||
- sql: | | ||
explain select * from t1 where a = 1; | ||
desc: use storage filter for primary key | ||
before: | ||
- create table t1(a int primary key, b int); | ||
insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); | ||
tasks: | ||
- sql: | | ||
explain select * from t1 where a > 1 and a < 3 and b > 1; | ||
desc: use storage filter for a combination of primary key and other keys | ||
before: | ||
- create table t1(a int primary key, b int); | ||
insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); | ||
tasks: | ||
- sql: | | ||
explain select * from t1 where a > 1 and a < 0 and b > 1; | ||
desc: use storage filter for a combination of primary key (always false) and other keys | ||
before: | ||
- create table t1(a int primary key, b int); | ||
insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); | ||
tasks: | ||
- sql: | | ||
explain select * from t1 where a > 1 and a > 3 and b > 1; | ||
desc: use storage filter for a combination of primary key (could be eliminated) and other keys | ||
before: | ||
- create table t1(a int primary key, b int); | ||
insert into t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); | ||
tasks: | ||
Oops, something went wrong.