-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: improve plan cache param eval and insert const #10746
Conversation
/bench |
Codecov Report
@@ Coverage Diff @@
## master #10746 +/- ##
================================================
- Coverage 81.4186% 81.4114% -0.0072%
================================================
Files 438 434 -4
Lines 94993 93536 -1457
================================================
- Hits 77342 76149 -1193
+ Misses 12174 11917 -257
+ Partials 5477 5470 -7 |
/bench |
/bench |
@lysu /bench command is offline now due to unstable aws server. It will be online after about 2 weeks after there is enough server in new IDC |
/build |
Would you like to take a look? @dbjoa |
@lysu Could you share a benchmark result of the PR? |
@dbjoa I have a benchmark at #10884 (comment) that combined two PR. In PrepareStmt parameter should always be a The idea is we know param is simple const and we can directly use it, do less eval/cast. 😄 and I will continue to improve this pr.. |
@lysu
|
@lysu can we review this PR now? |
/run-all-tests |
executor/insert_common.go
Outdated
if err != nil { | ||
return err | ||
var row []types.Datum | ||
if e.notAllConstant { |
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.
Try to avoid branch prediction failure.
// put below out of loop.
evalRowFunc := e.fastEvalRow
if e.notAllConstant {
evalRowFunc = e.evalRow
}
expression/constant.go
Outdated
if err != nil { | ||
return types.Duration{}, true, err | ||
} | ||
dur, err := types.ParseDuration(ctx.GetSessionVars().StmtCtx, val, types.MaxFsp) |
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's better to wrap a cast string as duration
function on this deferred param. A method is to transform the deferred param to a expression.Constant
, construct a unfolded scalar Cast
function upon that Constant
.
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.
good catch, can we do this on next PR to avoid useless str<->duration
?
we also need change
Line 538 in cb23b52
return pos, fmt.Sprintf("%s%d %02d:%02d:%02d", sign, days, hours, minutes, seconds) |
dt
in here be a duration datum, also some other types
expression/constant.go
Outdated
@@ -284,7 +412,6 @@ func (c *Constant) EvalJSON(ctx sessionctx.Context, _ chunk.Row) (json.BinaryJSO | |||
if err != nil { | |||
return json.BinaryJSON{}, true, err | |||
} | |||
fmt.Println("const eval json", val.GetMysqlJSON().String()) |
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.
???
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.
Could you use another PR to remove this line? We need to cherry pick this change to the release branches...
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
PTAL @crazycs520 |
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.
Rest LGTM
expression/constant.go
Outdated
@@ -284,7 +412,6 @@ func (c *Constant) EvalJSON(ctx sessionctx.Context, _ chunk.Row) (json.BinaryJSO | |||
if err != nil { | |||
return json.BinaryJSON{}, true, err | |||
} | |||
fmt.Println("const eval json", val.GetMysqlJSON().String()) |
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.
Could you use another PR to remove this line? We need to cherry pick this change to the release branches...
/run-all-tests |
1 similar comment
/run-all-tests |
/run-unit-test |
Could we cherry-pick this PR to the release-3.0? |
/run-unit-test |
/run-all-tests |
1 similar comment
/run-all-tests |
@zz-jason ptal if free ~ thx |
/run-all-tests |
last day, testcase meet a problem: wrong parameter type introduce a cast function and that cast let query can not using right index(cast couldn't push down to tikv now), and that problem has be fixed, but maybe we better keep this in master to protect the risk to introduce other cast function and using wrong index. we can cherry-pick this after more test or after cast can be pushed down to tikv(in roadmap) PTAL @zz-jason if free, thx |
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
@lysu please merge the master branch and resolve conflicts. |
/run-all-tests |
cherry pick to release-3.0 failed |
What problem does this PR solve?
builtinGetParamStringSig
and interpreting running and also do cast from T to string then cast back to a stringinsert values .....
' s values just const, but we interpreted for each valueWhat is changed and how it works?
Check List
Tests
Code changes
N/A
Side effects
N/A
Related changes
This change is