Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Feb 14, 2023
1 parent 3116ca3 commit b652cd2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions planner/core/plan_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,23 @@ func TestNonPreparedPlanCacheHints(t *testing.T) {
tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1"))
}

func TestNonPreparedPlanCacheBinding(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)
tk.MustExec("create table t(a int, index(a))")
tk.MustExec("set tidb_enable_non_prepared_plan_cache=1")

tk.MustExec("create binding for select * from t where a=1 using select /*+ use_index(t, a) */ * from t where a=1")
tk.MustExec("select * from t where a=1")
tk.MustExec("select * from t where a=1")
tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0"))
tk.MustExec("drop binding for select * from t where a=1")
tk.MustExec("select * from t where a=1")
tk.MustExec("select * from t where a=1")
tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1"))
}

func TestNonPreparedPlanCacheWithExplain(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
Expand Down

0 comments on commit b652cd2

Please sign in to comment.