Skip to content

Commit

Permalink
planner: stabilize the vector index test (pingcap#58254)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Dec 20, 2024
1 parent 3f2432d commit 06f72a4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,62 @@
{
"SQL": "explain format = 'brief' select * from t1;",
"Plan": [
"TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where a<1;",
"Plan": [
"TableReader 16334.85 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 16334.85 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 16334.85 mpp[tiflash] table:t1 pushed down filter:lt(test.t1.a, 1), keep order:false, stats:pseudo"
"TableReader 15.95 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 15.95 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 15.95 mpp[tiflash] lt(test.t1.a, 1)",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where vec = '[1,1,1]'",
"Plan": [
"TableReader 49.15 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 49.15 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.vec, [1,1,1]), keep order:false, stats:pseudo"
"TableReader 0.05 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 0.05 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 0.05 mpp[tiflash] eq(test.t1.vec, [1,1,1])",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where vec_cosine_distance(vec, '[1,1,1]') < 0.1",
"Plan": [
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
"TableReader 38.40 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 38.40 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 38.40 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as dis from t1 having dis < 0.1",
"Plan": [
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 39321.60 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
"TableReader 38.40 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 38.40 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 38.40 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─Selection 38.40 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 order by vec_cosine_distance(vec, '[1,1,1]')",
"Plan": [
"Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─Sort 49152.00 root Column#7",
" └─Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"Projection 48.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─Sort 48.00 root Column#7",
" └─Projection 48.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand Down Expand Up @@ -102,8 +104,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -117,8 +119,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -132,8 +134,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -147,8 +149,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, test.t1.vec, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -162,8 +164,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -177,8 +179,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -192,8 +194,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -207,8 +209,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -222,8 +224,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -237,19 +239,19 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as d from t1 order by d",
"Plan": [
"Sort 49152.00 root Column#7",
"└─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 49152.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"Sort 48.00 root Column#7",
"└─TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 48.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand Down Expand Up @@ -288,15 +290,13 @@
{
"SQL": "explain format = 'brief' select * from t1 where a=0 order by vec_cosine_distance(vec, '[1,1,1]') limit 1",
"Plan": [
"Projection 1.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─TopN 1.00 root Column#8, offset:0, count:1",
" └─Projection 1.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#8",
" └─TableReader 1.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 49.15 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.a, 0), keep order:false, stats:pseudo"
"Projection 0.05 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─TopN 0.05 root Column#7, offset:0, count:1",
" └─Projection 0.05 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableReader 0.05 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 0.05 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 0.05 mpp[tiflash] eq(test.t1.a, 0)",
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestTiFlashANNIndex(t *testing.T) {
('[2,2,2]', 2, 2, '[2,2,2]', '[2,2,2]'),
('[3,3,3]', 3, 3, '[3,3,3]', '[3,3,3]')
`)
for i := 0; i < 14; i++ {
for i := 0; i < 4; i++ {
tk.MustExec("insert into t1(vec, a, b, c, d) select vec, a, b, c, d from t1")
}
dom := domain.GetDomain(tk.Session())
Expand Down

0 comments on commit 06f72a4

Please sign in to comment.