-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: support vector index in planner #56204
Conversation
a475b88
to
2bdb3b6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #56204 +/- ##
================================================
+ Coverage 73.3611% 76.0249% +2.6637%
================================================
Files 1626 1649 +23
Lines 449213 457362 +8149
================================================
+ Hits 329548 347709 +18161
+ Misses 99482 87974 -11508
- Partials 20183 21679 +1496
Flags with carried forward coverage won't be shown. Click here to find out more.
|
2bdb3b6
to
35bdfee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other parts lgtm
TiFlashMem: costusage.CostVer2Factor{Name: "tiflash_mem_factor", Value: 0.05}, | ||
TiDBDisk: costusage.CostVer2Factor{Name: "tidb_disk_factor", Value: 200.00}, | ||
TiDBRequest: costusage.CostVer2Factor{Name: "tidb_request_factor", Value: 6000000.00}, | ||
ANNIndexStart: costusage.CostVer2Factor{Name: "ann_index_start_factor", Value: 0.000144}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this value be decided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to benchmark of comparing:
- TiFlash Ann Top K
- TiFlash Read K rows
pkg/planner/core/explain.go
Outdated
} | ||
} | ||
buffer.WriteString(", limit:") | ||
buffer.WriteString(fmt.Sprint(p.AnnIndexExtra.TopK)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strconv.FormatUint()
"Warning 1105 No predicate column has been collected yet for table test.t, so only indexes and the columns composing the indexes will be analyzed", | ||
"Warning 1105 The version 2 would collect all statistics not only the selected indexes", | ||
"Warning 1105 analyzing vector index is not supported, skip idx", | ||
"Warning 1105 analyzing vector index is not supported, skip idx2")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyze table t index idx
we specify idx only, while idx2 is checked and throw warnings, it that normal?
pkg/expression/vs_helper.go
Outdated
// ExtractVectorSearch extracts a VectorSearchExpr from an expression. | ||
// NOTE: not all VectorSearch functions are supported by the index. The caller | ||
// needs to check the distance function name. | ||
func ExtractVectorSearch(expr Expression) (*VectorSearchExpr, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not let VectorSearchExpr be an another expression Expression implementor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then we could do this in getFunction verify args
and the handling in pkg/planner/core/task.go
xx31 will be more clean
pkg/planner/core/task.go
Outdated
return false | ||
} | ||
ts.AnnIndexExtra.RefVecF32 = vs.Vec.SerializeTo(nil) | ||
ts.AnnIndexExtra.TopK = uint32(p.Count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better add some comments for this function
we could only see: that it checks some elements in topN's by item, then fills some fields in ts. what is it used for? another projection injection logic is not seen here?
This comment was marked as resolved.
This comment was marked as resolved.
f5f94db
to
afa9ff7
Compare
b62ad3d
to
add4469
Compare
Signed-off-by: Wish <breezewish@outlook.com>
tidbcloud/tidb-cse#940 tidbcloud/tidb-cse#920 Signed-off-by: Wish <breezewish@outlook.com>
2d015d8
to
bf3a8e7
Compare
…s/tidb into support-planner-cbo * 'support-planner-cbo' of ssh://ssh.github.com:443/winoros/tidb: address comments
go.mod
Outdated
@@ -307,7 +307,7 @@ require ( | |||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect | |||
google.golang.org/protobuf v1.34.2 | |||
gopkg.in/inf.v0 v0.9.1 // indirect | |||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to revert it.
@breezewish: The specified target(s) for
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test pull-br-integration-test |
@breezewish: The specified target(s) for
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm for ddl part
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, tangenta, XuHuaiyu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test unit-test |
@breezewish: The specified target(s) for
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
if len(lt.ByItems) != 1 { | ||
return ret | ||
} | ||
vs := expression.ExtractVectorHelper(lt.ByItems[0].Expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about multiple order by items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no longer a vector search.
…into support-planner-cbo
/retest |
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: ref #54245, close #56510
Problem Summary:
What changed and how does it work?
Support to choose vector index by CBO and
USE INDEX
hint.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.