Skip to content
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

auto-analyze is slow due to hardcoded concurrency 1 #37183

Closed
chrysan opened this issue Aug 17, 2022 · 0 comments · Fixed by #37078
Closed

auto-analyze is slow due to hardcoded concurrency 1 #37183

chrysan opened this issue Aug 17, 2022 · 0 comments · Fixed by #37078
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@chrysan
Copy link
Contributor

chrysan commented Aug 17, 2022

Enhancement

auto-analyze concurrency is now hardcoded to be 1 which causes auto-analyze runs too slowly and may fail due to exceeding gc-life-time at versions before v6.2

tidb/executor/adapter.go

Lines 120 to 135 in 3507a72

if _, ok := a.plan.(*plan.Analyze); ok && ctx.GetSessionVars().InRestrictedSQL {
oriStats := ctx.GetSessionVars().Systems[variable.TiDBBuildStatsConcurrency]
oriScan := ctx.GetSessionVars().DistSQLScanConcurrency
oriIndex := ctx.GetSessionVars().IndexSerialScanConcurrency
oriIso := ctx.GetSessionVars().Systems[variable.TxnIsolation]
ctx.GetSessionVars().Systems[variable.TiDBBuildStatsConcurrency] = "1"
ctx.GetSessionVars().DistSQLScanConcurrency = 1
ctx.GetSessionVars().IndexSerialScanConcurrency = 1
ctx.GetSessionVars().Systems[variable.TxnIsolation] = ast.ReadCommitted
defer func() {
ctx.GetSessionVars().Systems[variable.TiDBBuildStatsConcurrency] = oriStats
ctx.GetSessionVars().DistSQLScanConcurrency = oriScan
ctx.GetSessionVars().IndexSerialScanConcurrency = oriIndex
ctx.GetSessionVars().Systems[variable.TxnIsolation] = oriIso
}()
}

@chrysan chrysan added the type/enhancement The issue or PR belongs to an enhancement. label Aug 17, 2022
@chrysan chrysan self-assigned this Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant