Skip to content

Commit 1b79291

Browse files
Tristan1900ti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#63285
Signed-off-by: ti-chi-bot <[email protected]>
1 parent 69b1dbe commit 1b79291

File tree

9 files changed

+613
-65
lines changed

9 files changed

+613
-65
lines changed

pkg/planner/core/planbuilder.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ func (b *PlanBuilder) buildDropBindPlan(v *ast.DropBindingStmt) (base.Plan, erro
789789
b.visitInfo = appendVisitInfo(b.visitInfo, mysql.SuperPriv, "", "", "", nil)
790790
return p, nil
791791
}
792-
793792
func (b *PlanBuilder) buildSetBindingStatusPlan(v *ast.SetBindingStmt) (base.Plan, error) {
794793
var p *SQLBindPlan
795794
if v.OriginNode != nil {
@@ -1276,7 +1275,7 @@ func getPossibleAccessPaths(ctx base.PlanContext, tableHints *hint.PlanHints, in
12761275

12771276
hasScanHint = true
12781277

1279-
// It is syntactically valid to omit index_list for USE INDEX, which means use no indexes.
1278+
// It is syntactically valid to omit index_list for USE INDEX, which means "use no indexes".
12801279
// Omitting index_list for FORCE INDEX or IGNORE INDEX is a syntax error.
12811280
// See https://dev.mysql.com/doc/refman/8.0/en/index-hints.html.
12821281
if !isolationReadEnginesHasTiKV && hint.IndexNames == nil {
@@ -1489,7 +1488,6 @@ func (b *PlanBuilder) buildPrepare(x *ast.PrepareStmt) base.Plan {
14891488
}
14901489
return p
14911490
}
1492-
14931491
func (b *PlanBuilder) buildAdmin(ctx context.Context, as *ast.AdminStmt) (base.Plan, error) {
14941492
var ret base.Plan
14951493
var err error
@@ -2273,7 +2271,6 @@ func (b *PlanBuilder) getFullAnalyzeColumnsInfo(
22732271

22742272
return nil, nil, nil
22752273
}
2276-
22772274
func (b *PlanBuilder) getColumnsBasedOnPredicateColumns(
22782275
tbl *resolve.TableNameW,
22792276
predicateCols, mustAnalyzedCols *calcOnceMap,
@@ -3067,8 +3064,8 @@ var analyzeOptionDefault = map[ast.AnalyzeOptionType]uint64{
30673064
// TopN reduced from 500 to 100 due to concerns over large number of TopN values collected for customers with many tables.
30683065
// 100 is more inline with other databases. 100-256 is also common for NumBuckets with other databases.
30693066
var analyzeOptionDefaultV2 = map[ast.AnalyzeOptionType]uint64{
3070-
ast.AnalyzeOptNumBuckets: 256,
3071-
ast.AnalyzeOptNumTopN: 100,
3067+
ast.AnalyzeOptNumBuckets: statistics.DefaultHistogramBuckets,
3068+
ast.AnalyzeOptNumTopN: statistics.DefaultTopNValue,
30723069
ast.AnalyzeOptCMSketchWidth: 2048,
30733070
ast.AnalyzeOptCMSketchDepth: 5,
30743071
ast.AnalyzeOptNumSamples: 0,
@@ -3820,8 +3817,12 @@ func (b *PlanBuilder) buildSimple(ctx context.Context, node ast.StmtNode) (base.
38203817
}
38213818
return p, nil
38223819
}
3820+
<<<<<<< HEAD
38233821

38243822
func collectVisitInfoFromRevokeStmt(sctx base.PlanContext, vi []visitInfo, stmt *ast.RevokeStmt) ([]visitInfo, error) {
3823+
=======
3824+
func collectVisitInfoFromRevokeStmt(ctx context.Context, sctx base.PlanContext, vi []visitInfo, stmt *ast.RevokeStmt) ([]visitInfo, error) {
3825+
>>>>>>> b75bdd1257e (stats: optimize build topn and histogram (#63285))
38253826
// To use REVOKE, you must have the GRANT OPTION privilege,
38263827
// and you must have the privileges that you are granting.
38273828
dbName := stmt.Level.DBName
@@ -5133,7 +5134,6 @@ func checkForUserVariables(in ast.Node) error {
51335134
}
51345135
return nil
51355136
}
5136-
51375137
func (b *PlanBuilder) buildDDL(ctx context.Context, node ast.DDLNode) (base.Plan, error) {
51385138
var authErr error
51395139
switch v := node.(type) {

pkg/statistics/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ go_library(
1010
"cmsketch.go",
1111
"cmsketch_util.go",
1212
"column.go",
13+
"constants.go",
1314
"debugtrace.go",
1415
"estimate.go",
1516
"fmsketch.go",
@@ -46,6 +47,7 @@ go_library(
4647
"//pkg/util/context",
4748
"//pkg/util/dbterror",
4849
"//pkg/util/fastrand",
50+
"//pkg/util/generic",
4951
"//pkg/util/hack",
5052
"//pkg/util/intest",
5153
"//pkg/util/logutil",
@@ -82,7 +84,11 @@ go_test(
8284
data = glob(["testdata/**"]),
8385
embed = [":statistics"],
8486
flaky = True,
87+
<<<<<<< HEAD
8588
shard_count = 38,
89+
=======
90+
shard_count = 43,
91+
>>>>>>> b75bdd1257e (stats: optimize build topn and histogram (#63285))
8692
deps = [
8793
"//pkg/config",
8894
"//pkg/meta/model",

0 commit comments

Comments
 (0)