Skip to content

Commit 3b0ccd0

Browse files
Fix bug in vtexplain around JOINs (vitessio#12383)
Signed-off-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Andres Taylor <andres@planetscale.com>
1 parent e3d889b commit 3b0ccd0

File tree

5 files changed

+205
-161
lines changed

5 files changed

+205
-161
lines changed

go/vt/vtexplain/testdata/multi-output/unsharded-output.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ select ID from t1
4545
1 ks_unsharded/-: select ID from t1 limit 10001
4646

4747
----------------------------------------------------------------------
48+
select t1.id, t2.c2 from t1 join t2 on t1.id = t2.t1_id where t2.c2 in (1)
49+
50+
1 ks_unsharded/-: select t1.id, t2.c2 from t1 join t2 on t1.id = t2.t1_id where t2.c2 in (1) limit 10001
51+
52+
----------------------------------------------------------------------

go/vt/vtexplain/testdata/test-schema.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ create table t1 (
44
floatval float not null default 0,
55
primary key (id)
66
);
7+
create table t2 (
8+
id bigint(20) unsigned not null,
9+
t1_id bigint(20) unsigned not null default 0,
10+
c2 bigint(20) null,
11+
primary key (id)
12+
);
713

814
create table user (
915
id bigint,

go/vt/vtexplain/testdata/test-vschema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"sharded": false,
44
"tables": {
55
"t1": {},
6+
"t2": {},
67
"table_not_in_schema": {}
78
}
89
},

go/vt/vtexplain/testdata/unsharded-queries.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ update t1 set floatval = 9.99;
66
delete from t1 where id = 100;
77
insert into t1 (id,intval,floatval) values (1,2,3.14) on duplicate key update intval=3, floatval=3.14;
88
select ID from t1;
9+
select t1.id, t2.c2 from t1 join t2 on t1.id = t2.t1_id where t2.c2 in (1);

0 commit comments

Comments
 (0)