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

planner: enable non-prep plan cache by default #43145

Merged
merged 6 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,13 @@ func TestSetVar(t *testing.T) {

// test variable 'tidb_enable_non_prepared_plan_cache'
// global scope
tk.MustQuery("select @@global.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("0")) // default value
tk.MustQuery("select @@global.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("1")) // default value
tk.MustExec("set global tidb_enable_non_prepared_plan_cache = 1")
tk.MustQuery("select @@global.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("1"))
tk.MustExec("set global tidb_enable_non_prepared_plan_cache = 0")
tk.MustQuery("select @@global.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("0"))
// session scope
tk.MustQuery("select @@session.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("0")) // default value
tk.MustQuery("select @@session.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("1")) // default value
tk.MustExec("set session tidb_enable_non_prepared_plan_cache = 1")
tk.MustQuery("select @@session.tidb_enable_non_prepared_plan_cache").Check(testkit.Rows("1"))
tk.MustExec("set session tidb_enable_non_prepared_plan_cache = 0")
Expand Down
2 changes: 1 addition & 1 deletion session/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ func TestTiDBNonPrepPlanCacheUpgradeFrom540To700(t *testing.T) {
require.Equal(t, 1, chk.NumRows())
row := chk.GetRow(0)
require.Equal(t, 2, row.Len())
require.Equal(t, "OFF", row.GetString(1)) // tidb_enable_non_prepared_plan_cache = off
require.Equal(t, variable.BoolToOnOff(variable.DefTiDBEnableNonPreparedPlanCache), row.GetString(1)) // tidb_enable_non_prepared_plan_cache = off

res = mustExecToRecodeSet(t, seCurVer, fmt.Sprintf("select * from mysql.GLOBAL_VARIABLES where variable_name='%s'", variable.TiDBNonPreparedPlanCacheSize))
chk = res.NewChunk(nil)
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ const (
DefTiDBEnableFastReorg = true
DefTiDBDDLDiskQuota = 100 * 1024 * 1024 * 1024 // 100GB
DefExecutorConcurrency = 5
DefTiDBEnableNonPreparedPlanCache = false
DefTiDBEnableNonPreparedPlanCache = true
cfzjywxk marked this conversation as resolved.
Show resolved Hide resolved
DefTiDBNonPreparedPlanCacheSize = 100
DefTiDBPlanCacheMaxPlanSize = 2 * size.MB
DefTiDBEnableTiFlashReadForWriteStmt = false
Expand Down