Skip to content

Commit

Permalink
optimizer/plan: add more test for multi column index.
Browse files Browse the repository at this point in the history
  • Loading branch information
coocood committed Jan 19, 2016
1 parent 361c3da commit 947131f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions optimizer/plan/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,19 @@ func (s *testPlanSuite) TestBestPlan(c *C) {
},
{
sql: "select * from t where c = 0 and d = 0",
best: "Index(t.c_d)->Fields",
best: "Index(t.c_d_e)->Fields",
},
{
sql: "select * from t where c = 0 and d = 0 and e = 0",
best: "Index(t.c_d_e)->Fields",
},
{
sql: "select * from t where (d = 0 and e = 0) and c = 0",
best: "Index(t.c_d_e)->Fields",
},
{
sql: "select * from t where e = 0 and (d = 0 and c = 0)",
best: "Index(t.c_d_e)->Fields",
},
{
sql: "select * from t where b like 'abc%'",
Expand Down Expand Up @@ -341,14 +353,17 @@ func mockResolve(node ast.Node) {
},
},
{
Name: model.NewCIStr("c_d"),
Name: model.NewCIStr("c_d_e"),
Columns: []*model.IndexColumn{
{
Name: model.NewCIStr("c"),
},
{
Name: model.NewCIStr("d"),
},
{
Name: model.NewCIStr("e"),
},
},
},
}
Expand Down

0 comments on commit 947131f

Please sign in to comment.