Skip to content

Commit 6ef43e0

Browse files
authored
allow queries selecting distance to use vector index (#22426)
when SELECT and ORDER BY have the same vector distance function, index should be used. Approved by: @heni02, @ouyuanning, @XuPeng-SH
1 parent f48ad1c commit 6ef43e0

File tree

7 files changed

+128
-110
lines changed

7 files changed

+128
-110
lines changed

pkg/sql/plan/apply_indices_hnsw.go

Lines changed: 42 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ func (builder *QueryBuilder) checkValidHnswDistFn(nodeID int32, projNode, sortNo
3434
return false
3535
}
3636

37-
distFnExpr := sortNode.OrderBy[0].Expr.GetF()
37+
orderExpr := sortNode.OrderBy[0].Expr
38+
distFnExpr := orderExpr.GetF()
3839
if distFnExpr == nil {
39-
return false
40+
childNode := builder.qry.Nodes[sortNode.Children[0]]
41+
if childNode.NodeType == plan.Node_PROJECT {
42+
distFnExpr = childNode.ProjectList[orderExpr.GetCol().ColPos].GetF()
43+
}
44+
45+
if distFnExpr == nil {
46+
return false
47+
}
4048
}
4149
if _, ok := metric.DistFuncOpTypes[distFnExpr.Func.ObjName]; !ok {
4250
return false
@@ -129,7 +137,13 @@ func (builder *QueryBuilder) applyIndicesForSortUsingHnsw(nodeID int32, projNode
129137
}
130138
tblcfgstr := string(cfgbytes)
131139

132-
distFnExpr := sortNode.OrderBy[0].Expr.GetF()
140+
var childNode *plan.Node
141+
orderExpr := sortNode.OrderBy[0].Expr
142+
distFnExpr := orderExpr.GetF()
143+
if distFnExpr == nil {
144+
childNode = builder.qry.Nodes[sortNode.Children[0]]
145+
distFnExpr = childNode.ProjectList[orderExpr.GetCol().ColPos].GetF()
146+
}
133147
sortDirection := sortNode.OrderBy[0].Flag // For the most part, it is ASC
134148

135149
_, value, ok := builder.getArgsFromDistFn(scanNode, distFnExpr, keypart)
@@ -143,13 +157,13 @@ func (builder *QueryBuilder) applyIndicesForSortUsingHnsw(nodeID int32, projNode
143157
// JOIN between source table and hnsw_search table function
144158
var exprs tree.Exprs
145159

146-
exprs = append(exprs, tree.NewNumVal[string](params, params, false, tree.P_char))
147-
exprs = append(exprs, tree.NewNumVal[string](tblcfgstr, tblcfgstr, false, tree.P_char))
160+
exprs = append(exprs, tree.NewNumVal(params, params, false, tree.P_char))
161+
exprs = append(exprs, tree.NewNumVal(tblcfgstr, tblcfgstr, false, tree.P_char))
148162

149163
fnexpr := value.GetF()
150164
f32vec := fnexpr.Args[0].GetLit().GetSval()
151165

152-
valExpr := &tree.CastExpr{Expr: tree.NewNumVal[string](f32vec, f32vec, false, tree.P_char),
166+
valExpr := &tree.CastExpr{Expr: tree.NewNumVal(f32vec, f32vec, false, tree.P_char),
153167
Type: &tree.T{InternalType: tree.InternalType{Oid: uint32(defines.MYSQL_TYPE_VAR_STRING),
154168
FamilyString: "vecf32", Family: tree.ArrayFamily, DisplayWith: partType.Width}}}
155169

@@ -232,19 +246,20 @@ func (builder *QueryBuilder) applyIndicesForSortUsingHnsw(nodeID int32, projNode
232246
scanNode.Offset = nil
233247

234248
// Create SortBy with distance column from table function
235-
orderByScore := make([]*OrderBySpec, 0, 1)
236-
orderByScore = append(orderByScore, &OrderBySpec{
237-
Expr: &Expr{
238-
Typ: curr_node.TableDef.Cols[1].Typ, // score column
239-
Expr: &plan.Expr_Col{
240-
Col: &plan.ColRef{
241-
RelPos: curr_node.BindingTags[0],
242-
ColPos: 1, // score column
249+
orderByScore := []*OrderBySpec{
250+
{
251+
Expr: &Expr{
252+
Typ: curr_node.TableDef.Cols[1].Typ, // score column
253+
Expr: &plan.Expr_Col{
254+
Col: &plan.ColRef{
255+
RelPos: curr_node.BindingTags[0],
256+
ColPos: 1, // score column
257+
},
243258
},
244259
},
260+
Flag: sortDirection,
245261
},
246-
Flag: sortDirection,
247-
})
262+
}
248263

249264
sortByID := builder.appendNode(&plan.Node{
250265
NodeType: plan.Node_SORT,
@@ -254,23 +269,19 @@ func (builder *QueryBuilder) applyIndicesForSortUsingHnsw(nodeID int32, projNode
254269

255270
projNode.Children[0] = sortByID
256271

257-
/*
258-
// check equal distFn and only compute once for equal function()
259-
projids := builder.findEqualDistFnFromProject(projNode, distFnExpr)
260-
261-
// replace the project with ColRef (same distFn as the order by)
262-
for _, id := range projids {
263-
projNode.ProjectList[id] = &Expr{
264-
Typ: curr_node.TableDef.Cols[1].Typ,
265-
Expr: &plan.Expr_Col{
266-
Col: &plan.ColRef{
267-
RelPos: curr_node.BindingTags[0],
268-
ColPos: 1, // score
269-
},
270-
},
272+
if childNode != nil {
273+
sortIdx := orderExpr.GetCol().ColPos
274+
projMap := make(map[[2]int32]*plan.Expr)
275+
for i, proj := range childNode.ProjectList {
276+
if i == int(sortIdx) {
277+
projMap[[2]int32{childNode.BindingTags[0], int32(i)}] = DeepCopyExpr(orderByScore[0].Expr)
278+
} else {
279+
projMap[[2]int32{childNode.BindingTags[0], int32(i)}] = proj
271280
}
272281
}
273-
*/
282+
283+
replaceColumnsForNode(projNode, projMap)
284+
}
274285

275286
return nodeID, nil
276287
}
@@ -304,66 +315,3 @@ func (builder *QueryBuilder) getArgsFromDistFn(scanNode *plan.Node, distfn *plan
304315

305316
return key, value, found
306317
}
307-
308-
/*
309-
func (builder *QueryBuilder) findPkFromProject(projNode *plan.Node, pkPos int32) []int32 {
310-
311-
projids := make([]int32, 0)
312-
for i, expr := range projNode.ProjectList {
313-
if expr.GetCol() != nil {
314-
if expr.GetCol().ColPos == pkPos {
315-
projids = append(projids, int32(i))
316-
}
317-
}
318-
}
319-
return projids
320-
}
321-
322-
// e.g. SELECT a, L2_DISTANCE(b, '[0, ..]') FROM SRC ORDER BY L2_DISTANCE(b, '[0,..]') limit 4
323-
// the plan is 'project -> sort -> project -> tablescan'
324-
func (builder *QueryBuilder) findEqualDistFnFromProject(projNode *plan.Node, distfn *plan.Function) []int32 {
325-
326-
projids := make([]int32, 0)
327-
optype := distfn.Func.ObjName
328-
329-
for i, expr := range projNode.ProjectList {
330-
fn := expr.GetF()
331-
if fn == nil {
332-
continue
333-
}
334-
335-
if fn.Func.ObjName != optype {
336-
continue
337-
}
338-
339-
// check args
340-
341-
equal := false
342-
for j := range distfn.Args {
343-
targ := distfn.Args[j]
344-
arg := fn.Args[j]
345-
346-
if targ.GetCol() != nil && arg.GetCol() != nil && targ.GetCol().ColPos == arg.GetCol().ColPos {
347-
equal = true
348-
continue
349-
}
350-
if targ.GetF() != nil && arg.GetF() != nil && targ.GetF().Func.ObjName == "cast" && arg.GetF().Func.ObjName == "cast" {
351-
tv32 := targ.GetF().Args[0].GetLit().GetSval()
352-
v32 := arg.GetF().Args[0].GetLit().GetSval()
353-
if tv32 == v32 {
354-
equal = true
355-
continue
356-
}
357-
}
358-
359-
equal = false
360-
}
361-
362-
if equal {
363-
projids = append(projids, int32(i))
364-
}
365-
}
366-
367-
return projids
368-
}
369-
*/

pkg/sql/plan/apply_indices_ivfflat.go

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ func (builder *QueryBuilder) checkValidIvfflatDistFn(nodeID int32, projNode, sor
3434
return false
3535
}
3636

37-
distFnExpr := sortNode.OrderBy[0].Expr.GetF()
37+
orderExpr := sortNode.OrderBy[0].Expr
38+
distFnExpr := orderExpr.GetF()
3839
if distFnExpr == nil {
39-
return false
40+
childNode := builder.qry.Nodes[sortNode.Children[0]]
41+
if childNode.NodeType == plan.Node_PROJECT {
42+
distFnExpr = childNode.ProjectList[orderExpr.GetCol().ColPos].GetF()
43+
}
44+
45+
if distFnExpr == nil {
46+
return false
47+
}
4048
}
4149
if _, ok := metric.DistFuncOpTypes[distFnExpr.Func.ObjName]; !ok {
4250
return false
@@ -150,7 +158,13 @@ func (builder *QueryBuilder) applyIndicesForSortUsingIvfflat(nodeID int32, projN
150158
}
151159
tblcfgstr := string(cfgbytes)
152160

153-
distFnExpr := sortNode.OrderBy[0].Expr.GetF()
161+
var childNode *plan.Node
162+
orderExpr := sortNode.OrderBy[0].Expr
163+
distFnExpr := orderExpr.GetF()
164+
if distFnExpr == nil {
165+
childNode = builder.qry.Nodes[sortNode.Children[0]]
166+
distFnExpr = childNode.ProjectList[orderExpr.GetCol().ColPos].GetF()
167+
}
154168
sortDirection := sortNode.OrderBy[0].Flag // For the most part, it is ASC
155169

156170
_, value, ok := builder.getArgsFromDistFn(scanNode, distFnExpr, keypart)
@@ -164,16 +178,16 @@ func (builder *QueryBuilder) applyIndicesForSortUsingIvfflat(nodeID int32, projN
164178
// JOIN between source table and hnsw_search table function
165179
var exprs tree.Exprs
166180

167-
exprs = append(exprs, tree.NewNumVal[string](params, params, false, tree.P_char))
168-
exprs = append(exprs, tree.NewNumVal[string](tblcfgstr, tblcfgstr, false, tree.P_char))
181+
exprs = append(exprs, tree.NewNumVal(params, params, false, tree.P_char))
182+
exprs = append(exprs, tree.NewNumVal(tblcfgstr, tblcfgstr, false, tree.P_char))
169183

170184
fnexpr := value.GetF()
171185
vecsval := fnexpr.Args[0].GetLit().GetSval()
172186
family := "vecf32"
173187
if value.Typ.GetId() == int32(types.T_array_float64) {
174188
family = "vecf64"
175189
}
176-
valExpr := &tree.CastExpr{Expr: tree.NewNumVal[string](vecsval, vecsval, false, tree.P_char),
190+
valExpr := &tree.CastExpr{Expr: tree.NewNumVal(vecsval, vecsval, false, tree.P_char),
177191
Type: &tree.T{InternalType: tree.InternalType{Oid: uint32(defines.MYSQL_TYPE_VAR_STRING),
178192
FamilyString: family, Family: tree.ArrayFamily, DisplayWith: partType.Width}}}
179193
exprs = append(exprs, valExpr)
@@ -260,19 +274,20 @@ func (builder *QueryBuilder) applyIndicesForSortUsingIvfflat(nodeID int32, projN
260274
scanNode.Offset = nil
261275

262276
// Create SortBy with distance column from table function
263-
orderByScore := make([]*OrderBySpec, 0, 1)
264-
orderByScore = append(orderByScore, &OrderBySpec{
265-
Expr: &Expr{
266-
Typ: curr_node.TableDef.Cols[1].Typ, // score column
267-
Expr: &plan.Expr_Col{
268-
Col: &plan.ColRef{
269-
RelPos: curr_node.BindingTags[0],
270-
ColPos: 1, // score column
277+
orderByScore := []*OrderBySpec{
278+
{
279+
Expr: &plan.Expr{
280+
Typ: curr_node.TableDef.Cols[1].Typ, // score column
281+
Expr: &plan.Expr_Col{
282+
Col: &plan.ColRef{
283+
RelPos: curr_node.BindingTags[0],
284+
ColPos: 1, // score column
285+
},
271286
},
272287
},
288+
Flag: sortDirection,
273289
},
274-
Flag: sortDirection,
275-
})
290+
}
276291

277292
sortByID := builder.appendNode(&plan.Node{
278293
NodeType: plan.Node_SORT,
@@ -282,5 +297,19 @@ func (builder *QueryBuilder) applyIndicesForSortUsingIvfflat(nodeID int32, projN
282297

283298
projNode.Children[0] = sortByID
284299

300+
if childNode != nil {
301+
sortIdx := orderExpr.GetCol().ColPos
302+
projMap := make(map[[2]int32]*plan.Expr)
303+
for i, proj := range childNode.ProjectList {
304+
if i == int(sortIdx) {
305+
projMap[[2]int32{childNode.BindingTags[0], int32(i)}] = DeepCopyExpr(orderByScore[0].Expr)
306+
} else {
307+
projMap[[2]int32{childNode.BindingTags[0], int32(i)}] = proj
308+
}
309+
}
310+
311+
replaceColumnsForNode(projNode, projMap)
312+
}
313+
285314
return nodeID, nil
286315
}

pkg/sql/plan/apply_indices_vector.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ package plan
1717
import "github.com/matrixorigin/matrixone/pkg/pb/plan"
1818

1919
func (builder *QueryBuilder) resolveScanNodeWithIndex(node *plan.Node, depth int32) *plan.Node {
20+
if node.NodeType == plan.Node_PROJECT && len(node.Children) == 1 {
21+
return builder.resolveScanNodeWithIndex(builder.qry.Nodes[node.Children[0]], depth)
22+
}
23+
2024
if depth == 0 {
2125
if node.NodeType == plan.Node_TABLE_SCAN && node.TableDef.Indexes != nil {
2226
return node

test/distributed/cases/vector/vector_hnsw.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,17 @@ select * from vector_cos_01 order by cosine_distance(b, "[1, 15, 15, 0, 5, 7, 5
300300
a b c
301301
9777 [16, 15, 0, 0, 5, 46, 5, 5, 4, 0, 0, 0, 28, 118, 12, 5, 75, 44, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13] 4
302302
9776 [10, 3, 8, 5, 48, 26, 5, 16, 17, 0, 0, 2, 132, 53, 1, 16, 112, 6, 0, 0, 7, 2, 1, 48, 48, 15, 18, 31, 3, 0, 0, 9, 6, 10, 19, 27, 50, 46, 17, 9, 18, 1, 4, 48, 132, 23, 3, 5, 132, 9, 4, 3, 11, 0, 2, 46, 84, 12, 10, 10, 1, 0, 12, 76, 26, 22, 16, 26, 35, 15, 3, 16, 15, 1, 51, 132, 125, 8, 1, 2, 132, 51, 67, 91, 8, 0, 0, 30, 126, 39, 32, 38, 4, 0, 1, 12, 24, 2, 2, 2, 4, 7, 2, 19, 93, 19, 70, 92, 2, 3, 1, 21, 36, 58, 132, 94, 0, 0, 0, 0, 21, 25, 57, 48, 1, 0, 0, 1] 3
303+
select *, cosine_distance(b, "[1, 15, 15, 0, 5, 7, 5, 5, 4, 0, 0, 0, 28, 1, 12, 5, 75, 20, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]") as orderbyfn from vector_cos_01 order by orderbyfn ASC LIMIT 2;
304+
a b c orderbyfn
305+
9777 [16, 15, 0, 0, 5, 46, 5, 5, 4, 0, 0, 0, 28, 118, 12, 5, 75, 44, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13] 4 0.03196156647468429
306+
9776 [10, 3, 8, 5, 48, 26, 5, 16, 17, 0, 0, 2, 132, 53, 1, 16, 112, 6, 0, 0, 7, 2, 1, 48, 48, 15, 18, 31, 3, 0, 0, 9, 6, 10, 19, 27, 50, 46, 17, 9, 18, 1, 4, 48, 132, 23, 3, 5, 132, 9, 4, 3, 11, 0, 2, 46, 84, 12, 10, 10, 1, 0, 12, 76, 26, 22, 16, 26, 35, 15, 3, 16, 15, 1, 51, 132, 125, 8, 1, 2, 132, 51, 67, 91, 8, 0, 0, 30, 126, 39, 32, 38, 4, 0, 1, 12, 24, 2, 2, 2, 4, 7, 2, 19, 93, 19, 70, 92, 2, 3, 1, 21, 36, 58, 132, 94, 0, 0, 0, 0, 21, 25, 57, 48, 1, 0, 0, 1] 3 0.2662930237053135
307+
select *, l2_distance(b, "[1, 15, 15, 0, 5, 7, 5, 5, 4, 0, 0, 0, 28, 1, 12, 5, 75, 20, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]") as orderbyfn from vector_cos_01 order by cosine_distance(b, "[1, 15, 15, 0, 5, 7, 5, 5, 4, 0, 0, 0, 28, 1, 12, 5, 75, 20, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]") ASC LIMIT 2;
308+
a b c orderbyfn
309+
9777 [16, 15, 0, 0, 5, 46, 5, 5, 4, 0, 0, 0, 28, 118, 12, 5, 75, 44, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13] 4 127.4205551147461
310+
9776 [10, 3, 8, 5, 48, 26, 5, 16, 17, 0, 0, 2, 132, 53, 1, 16, 112, 6, 0, 0, 7, 2, 1, 48, 48, 15, 18, 31, 3, 0, 0, 9, 6, 10, 19, 27, 50, 46, 17, 9, 18, 1, 4, 48, 132, 23, 3, 5, 132, 9, 4, 3, 11, 0, 2, 46, 84, 12, 10, 10, 1, 0, 12, 76, 26, 22, 16, 26, 35, 15, 3, 16, 15, 1, 51, 132, 125, 8, 1, 2, 132, 51, 67, 91, 8, 0, 0, 30, 126, 39, 32, 38, 4, 0, 1, 12, 24, 2, 2, 2, 4, 7, 2, 19, 93, 19, 70, 92, 2, 3, 1, 21, 36, 58, 132, 94, 0, 0, 0, 0, 21, 25, 57, 48, 1, 0, 0, 1] 3 364.642333984375
311+
select *, cosine_distance(b, "[2, 15, 15, 0, 5, 7, 5, 5, 4, 0, 0, 0, 28, 1, 12, 5, 75, 20, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]") as orderbyfn from vector_cos_01 order by cosine_distance(b, "[1, 15, 15, 0, 5, 7, 5, 5, 4, 0, 0, 0, 28, 1, 12, 5, 75, 20, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13]") ASC LIMIT 2;
312+
a b c orderbyfn
313+
9777 [16, 15, 0, 0, 5, 46, 5, 5, 4, 0, 0, 0, 28, 118, 12, 5, 75, 44, 5, 0, 6, 32, 6, 49, 41, 74, 9, 1, 0, 0, 0, 9, 1, 9, 16, 41, 71, 80, 3, 0, 0, 4, 3, 5, 51, 106, 11, 3, 112, 28, 13, 1, 4, 8, 3, 104, 118, 14, 1, 1, 0, 0, 0, 88, 3, 27, 46, 118, 108, 49, 2, 0, 1, 46, 118, 118, 27, 12, 0, 0, 33, 118, 118, 8, 0, 0, 0, 4, 118, 95, 40, 0, 0, 0, 1, 11, 27, 38, 12, 12, 18, 29, 3, 2, 13, 30, 94, 78, 30, 19, 9, 3, 31, 45, 70, 42, 15, 1, 3, 12, 14, 22, 16, 2, 3, 17, 24, 13] 4 0.031903373234243526
314+
9776 [10, 3, 8, 5, 48, 26, 5, 16, 17, 0, 0, 2, 132, 53, 1, 16, 112, 6, 0, 0, 7, 2, 1, 48, 48, 15, 18, 31, 3, 0, 0, 9, 6, 10, 19, 27, 50, 46, 17, 9, 18, 1, 4, 48, 132, 23, 3, 5, 132, 9, 4, 3, 11, 0, 2, 46, 84, 12, 10, 10, 1, 0, 12, 76, 26, 22, 16, 26, 35, 15, 3, 16, 15, 1, 51, 132, 125, 8, 1, 2, 132, 51, 67, 91, 8, 0, 0, 30, 126, 39, 32, 38, 4, 0, 1, 12, 24, 2, 2, 2, 4, 7, 2, 19, 93, 19, 70, 92, 2, 3, 1, 21, 36, 58, 132, 94, 0, 0, 0, 0, 21, 25, 57, 48, 1, 0, 0, 1] 3 0.26625744260882
303315
drop table vector_cos_01;
304316
SET experimental_hnsw_index = 0;

0 commit comments

Comments
 (0)