Skip to content

Commit

Permalink
statistics: improve estimation for index equal con ... (#17366) (#17611)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Jun 3, 2020
1 parent d54ced6 commit 90d9908
Show file tree
Hide file tree
Showing 5 changed files with 58,375 additions and 8 deletions.
29 changes: 29 additions & 0 deletions planner/core/cbo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,3 +855,32 @@ func (s *testAnalyzeSuite) TestTiFlashCostModel(c *C) {
}
}
}

func (s *testAnalyzeSuite) TestIndexEqualUnknown(c *C) {
defer testleak.AfterTest(c)()
store, dom, err := newStoreWithBootstrap()
c.Assert(err, IsNil)
testKit := testkit.NewTestKit(c, store)
defer func() {
dom.Close()
store.Close()
}()
testKit.MustExec("use test")
testKit.MustExec("drop table if exists t, t1")
testKit.MustExec("CREATE TABLE t(a bigint(20) NOT NULL, b bigint(20) NOT NULL, c bigint(20) NOT NULL, PRIMARY KEY (a,c,b), KEY (b))")
err = s.loadTableStats("analyzeSuiteTestIndexEqualUnknownT.json", dom)
c.Assert(err, IsNil)
var input []string
var output []struct {
SQL string
Plan []string
}
s.testData.GetTestCases(c, &input, &output)
for i, tt := range input {
s.testData.OnRecord(func() {
output[i].SQL = tt
output[i].Plan = s.testData.ConvertRowsToStrings(testKit.MustQuery(tt).Rows())
})
testKit.MustQuery(tt).Check(testkit.Rows(output[i].Plan...))
}
}
Loading

0 comments on commit 90d9908

Please sign in to comment.