-
Notifications
You must be signed in to change notification settings - Fork 275
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
[Tech Request]: use stats of external scan to set auto incr cache #15933
Labels
kind/tech-request
New feature or request
priority/p0
Critical feature that should be implemented in this version
Milestone
Comments
ouyuanning
added
kind/tech-request
New feature or request
priority/p0
Critical feature that should be implemented in this version
labels
May 9, 2024
利用统计信息来调整申请 首先梳理一下目前从 // pkg/sql/colexec/preinsert/preinsert.go L119
func genAutoIncrCol(bat *batch.Batch, proc *proc, arg *Argument) error {
// 调用incrservice的服务, 这里只需要关注第三个参数, `bat`
lastInsertValue, err := proc.IncrService.InsertValues(
proc.Ctx,
arg.TableDef.TblId,
bat)
...
}
// pkg/incrservice/column_cache.go L503
// 这里只需要关注rows参数, rows参数的来源是`bat.RowCount()`, 在`tableCache.InsertAutoValues`中被设置, 此处省略
func insertAutoValues[T constraints.Integer](
...
rows int,
...) {
...
col.preAllocate(ctx, tableID, rows, txnOp)
err := col.applyAutoValues(
ctx,
tableID,
rows,
...
}
// pkg/incrservice/column_cache.go L342
// 这里的count就是上面传递下来的rows, 它会检测目前剩余的缓存容量, 如果大于要申请的行数, 那么就忽略这次请求.
// 否则就申请, 如果申请的`rows`小于`col.cfg.CountPerAllocate`的话, 会被调整为`col.cfg.CountPerAllocate`
func (col *columnCache) preAllocate(
...
count int,
...) {
col.Lock()
defer col.Unlock()
if col.ranges.left() >= count {
return
}
...
} 快速过了一遍调用链路之后, 可以看出目前的逻辑是以 此外, 需要考虑 |
经讨论, 在这个分支上, 往 |
This was referenced May 10, 2024
mergify bot
pushed a commit
that referenced
this issue
May 10, 2024
实现 #15933 的子任务 Approved by: @m-schen, @ouyuanning
7 tasks
jensenojs
added a commit
to jensenojs/matrixone
that referenced
this issue
May 11, 2024
7 tasks
mergify bot
pushed a commit
that referenced
this issue
May 11, 2024
实现 #15933 的子任务 Approved by: @ouyuanning, @m-schen, @sukki37
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
kind/tech-request
New feature or request
priority/p0
Critical feature that should be implemented in this version
Is there an existing issue for the same tech request?
Does this tech request not affect user experience?
What would you like to be added ?
Why is this needed ?
use stats of external scan to set auto incr cache to improve performance
Additional information
No response
The text was updated successfully, but these errors were encountered: