Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner/core: implement skyline pruning #9337

Merged
merged 16 commits into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/explaintest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,6 @@ func loadAllTests() ([]string, error) {
if strings.HasSuffix(name, ".test") {
name = strings.TrimSuffix(name, ".test")

// if we use record and the result file exists, skip generating
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make ./run-all-tests -r all work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, maybe the logic in tidb-test repo should also be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will do it.

if record && resultExists(name) {
continue
}

if create && !strings.HasSuffix(name, "_stats") {
continue
}
Expand Down
28 changes: 14 additions & 14 deletions cmd/explaintest/r/access_path_selection.result
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ KEY `IDX_ab` (`a`, `b`)
);
explain select a from access_path_selection where a < 3;
id count task operator info
IndexReader_9 3323.33 root index:IndexScan_8
└─IndexScan_8 3323.33 cop table:access_path_selection, index:a, range:[-inf,3), keep order:false, stats:pseudo
IndexReader_6 3323.33 root index:IndexScan_5
└─IndexScan_5 3323.33 cop table:access_path_selection, index:a, range:[-inf,3), keep order:false, stats:pseudo
explain select a, b from access_path_selection where a < 3;
id count task operator info
IndexReader_12 3323.33 root index:IndexScan_11
└─IndexScan_11 3323.33 cop table:access_path_selection, index:a, b, range:[-inf,3), keep order:false, stats:pseudo
IndexReader_6 3323.33 root index:IndexScan_5
└─IndexScan_5 3323.33 cop table:access_path_selection, index:a, b, range:[-inf,3), keep order:false, stats:pseudo
explain select a, b from access_path_selection where b < 3;
id count task operator info
IndexLookUp_10 3323.33 root
├─IndexScan_8 3323.33 cop table:access_path_selection, index:b, range:[-inf,3), keep order:false, stats:pseudo
└─TableScan_9 3323.33 cop table:access_path_selection, keep order:false, stats:pseudo
explain select a, b from access_path_selection where a < 3 and b < 3;
id count task operator info
IndexReader_18 1104.45 root index:Selection_17
└─Selection_17 1104.45 cop lt(test.access_path_selection.b, 3)
└─IndexScan_16 3323.33 cop table:access_path_selection, index:a, b, range:[-inf,3), keep order:false, stats:pseudo
IndexReader_11 1104.45 root index:Selection_10
└─Selection_10 1104.45 cop lt(test.access_path_selection.b, 3)
└─IndexScan_9 3323.33 cop table:access_path_selection, index:a, b, range:[-inf,3), keep order:false, stats:pseudo
CREATE TABLE `outdated_statistics` (
`a` int,
`b` int,
Expand All @@ -41,9 +41,9 @@ analyze table outdated_statistics index idx_ab;
explain select * from outdated_statistics where a=1 and b=1 and c=1;
id count task operator info
IndexLookUp_11 0.00 root
├─IndexScan_8 0.00 cop table:outdated_statistics, index:a, range:[1,1], keep order:false
└─Selection_10 0.00 cop eq(test.outdated_statistics.b, 1), eq(test.outdated_statistics.c, 1)
└─TableScan_9 0.00 cop table:outdated_statistics, keep order:false
├─IndexScan_8 1.00 cop table:outdated_statistics, index:a, b, range:[1 1,1 1], keep order:false
└─Selection_10 0.00 cop eq(test.outdated_statistics.c, 1)
└─TableScan_9 1.00 cop table:outdated_statistics, keep order:false
CREATE TABLE `unknown_correlation` (
id int,
a int,
Expand All @@ -55,7 +55,7 @@ ANALYZE TABLE unknown_correlation;
EXPLAIN SELECT * FROM unknown_correlation WHERE a = 2 ORDER BY id limit 1;
id count task operator info
Limit_11 1.00 root offset:0, count:1
└─TableReader_29 1.00 root data:Limit_28
└─Limit_28 1.00 cop offset:0, count:1
└─Selection_26 1.00 cop eq(test.unknown_correlation.a, 2)
└─TableScan_25 4.17 cop table:unknown_correlation, range:[-inf,+inf], keep order:true
└─TableReader_24 1.00 root data:Limit_23
└─Limit_23 1.00 cop offset:0, count:1
└─Selection_21 1.00 cop eq(test.unknown_correlation.a, 2)
└─TableScan_20 4.17 cop table:unknown_correlation, range:[-inf,+inf], keep order:true
14 changes: 7 additions & 7 deletions cmd/explaintest/r/explain_complex.result
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ id count task operator info
Projection_10 0.00 root dt.id, dt.aid, dt.pt, dt.dic, dt.cm, rr.gid, rr.acd, rr.t, dt.p1, dt.p2, dt.p3, dt.p4, dt.p5, dt.p6_md5, dt.p7_md5
└─Limit_13 0.00 root offset:0, count:2000
└─IndexJoin_19 0.00 root inner join, inner:IndexLookUp_18, outer key:dt.aid, dt.dic, inner key:rr.aid, rr.dic
├─TableReader_47 0.00 root data:Selection_46
│ └─Selection_46 0.00 cop eq(dt.bm, 0), eq(dt.pt, "ios"), gt(dt.t, 1478185592), not(isnull(dt.dic))
│ └─TableScan_45 10000.00 cop table:dt, range:[0,+inf], keep order:false, stats:pseudo
├─TableReader_43 0.00 root data:Selection_42
│ └─Selection_42 0.00 cop eq(dt.bm, 0), eq(dt.pt, "ios"), gt(dt.t, 1478185592), not(isnull(dt.dic))
│ └─TableScan_41 10000.00 cop table:dt, range:[0,+inf], keep order:false, stats:pseudo
└─IndexLookUp_18 3.33 root
├─IndexScan_15 10.00 cop table:rr, index:aid, dic, range: decided by [dt.aid dt.dic], keep order:false, stats:pseudo
└─Selection_17 3.33 cop eq(rr.pt, "ios"), gt(rr.t, 1478185592)
Expand All @@ -164,10 +164,10 @@ explain select pc,cr,count(DISTINCT uid) as pay_users,count(oid) as pay_times,su
id count task operator info
Projection_5 1.00 root test.pp.pc, test.pp.cr, 3_col_0, 3_col_1, 3_col_2
└─HashAgg_7 1.00 root group by:test.pp.cr, test.pp.pc, funcs:count(distinct test.pp.uid), count(test.pp.oid), sum(test.pp.am), firstrow(test.pp.pc), firstrow(test.pp.cr)
└─IndexLookUp_28 0.00 root
├─IndexScan_25 0.40 cop table:pp, index:uid, pi, range:[18089709 510017,18089709 510017], [18089709 520017,18089709 520017], [18090780 510017,18090780 510017], [18090780 520017,18090780 520017], keep order:false, stats:pseudo
└─Selection_27 0.00 cop eq(test.pp.ps, 2), ge(test.pp.ppt, 1478188800), lt(test.pp.ppt, 1478275200)
└─TableScan_26 0.40 cop table:pp, keep order:false, stats:pseudo
└─IndexLookUp_24 0.00 root
├─IndexScan_21 0.40 cop table:pp, index:uid, pi, range:[18089709 510017,18089709 510017], [18089709 520017,18089709 520017], [18090780 510017,18090780 510017], [18090780 520017,18090780 520017], keep order:false, stats:pseudo
└─Selection_23 0.00 cop eq(test.pp.ps, 2), ge(test.pp.ppt, 1478188800), lt(test.pp.ppt, 1478275200)
└─TableScan_22 0.40 cop table:pp, keep order:false, stats:pseudo
CREATE TABLE `tbl_001` (`a` int, `b` int);
CREATE TABLE `tbl_002` (`a` int, `b` int);
CREATE TABLE `tbl_003` (`a` int, `b` int);
Expand Down
14 changes: 7 additions & 7 deletions cmd/explaintest/r/explain_complex_stats.result
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ id count task operator info
Projection_10 428.32 root dt.id, dt.aid, dt.pt, dt.dic, dt.cm, rr.gid, rr.acd, rr.t, dt.p1, dt.p2, dt.p3, dt.p4, dt.p5, dt.p6_md5, dt.p7_md5
└─Limit_13 428.32 root offset:0, count:2000
└─IndexJoin_19 428.32 root inner join, inner:IndexLookUp_18, outer key:dt.aid, dt.dic, inner key:rr.aid, rr.dic
├─TableReader_47 428.32 root data:Selection_46
│ └─Selection_46 428.32 cop eq(dt.bm, 0), eq(dt.pt, "ios"), gt(dt.t, 1478185592), not(isnull(dt.dic))
│ └─TableScan_45 2000.00 cop table:dt, range:[0,+inf], keep order:false
├─TableReader_43 428.32 root data:Selection_42
│ └─Selection_42 428.32 cop eq(dt.bm, 0), eq(dt.pt, "ios"), gt(dt.t, 1478185592), not(isnull(dt.dic))
│ └─TableScan_41 2000.00 cop table:dt, range:[0,+inf], keep order:false
└─IndexLookUp_18 970.00 root
├─IndexScan_15 1.00 cop table:rr, index:aid, dic, range: decided by [dt.aid dt.dic], keep order:false
└─Selection_17 970.00 cop eq(rr.pt, "ios"), gt(rr.t, 1478185592)
Expand All @@ -172,10 +172,10 @@ explain select pc,cr,count(DISTINCT uid) as pay_users,count(oid) as pay_times,su
id count task operator info
Projection_5 207.86 root test.pp.pc, test.pp.cr, 3_col_0, 3_col_1, 3_col_2
└─HashAgg_7 207.86 root group by:test.pp.cr, test.pp.pc, funcs:count(distinct test.pp.uid), count(test.pp.oid), sum(test.pp.am), firstrow(test.pp.pc), firstrow(test.pp.cr)
└─IndexLookUp_28 207.86 root
├─IndexScan_22 627.00 cop table:pp, index:ps, range:[2,2], keep order:false
└─Selection_24 207.86 cop ge(test.pp.ppt, 1478188800), in(test.pp.pi, 510017, 520017), in(test.pp.uid, 18089709, 18090780), lt(test.pp.ppt, 1478275200)
└─TableScan_23 627.00 cop table:pp, keep order:false
└─IndexLookUp_24 207.86 root
├─IndexScan_18 627.00 cop table:pp, index:ps, range:[2,2], keep order:false
└─Selection_20 207.86 cop ge(test.pp.ppt, 1478188800), in(test.pp.pi, 510017, 520017), in(test.pp.uid, 18089709, 18090780), lt(test.pp.ppt, 1478275200)
└─TableScan_19 627.00 cop table:pp, keep order:false
drop table if exists tbl_001;
CREATE TABLE tbl_001 (a int, b int);
load stats 's/explain_complex_stats_tbl_001.json';
Expand Down
Loading