Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b351c41
statistics: change default value of tidb_analyze_version to 1
yiwen92 Jan 19, 2022
a1e2830
Merge branch 'release-5.1' into release-5.1
yiwen92 Jan 19, 2022
ce44f65
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 8, 2022
4302b86
just test CICD.
yiwen92 Feb 8, 2022
17717a3
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 8, 2022
4d2f202
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 8, 2022
5af279a
Merge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 8, 2022
d7cc80a
Merge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 8, 2022
ec55dc0
Merge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 8, 2022
dd628c9
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 8, 2022
e06ea50
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 8, 2022
4dd95fa
Merge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 8, 2022
4e3c585
Merge branch 'release-5.1' into release-5.1
bb7133 Feb 9, 2022
e299a10
Merge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 8, 2022
609a7b8
:wqerge branch 'release-5.1' of github.com:yiwen92/tidb into release-5.1
yiwen92 Feb 9, 2022
b55026b
Merge branch 'release-5.1' into release-5.1
yiwen92 Feb 9, 2022
8604d19
Merge branch 'release-5.1' into release-5.1
ti-chi-bot Feb 9, 2022
b0710ed
Merge branch 'release-5.1' into release-5.1
ti-chi-bot Feb 9, 2022
c553832
Merge branch 'release-5.1' into release-5.1
ti-chi-bot Feb 9, 2022
789f551
correct test file
winoros Feb 9, 2022
e7a5600
Merge branch 'release-5.1' into release-5.1
bb7133 Feb 10, 2022
790d9e0
Merge branch 'release-5.1' into release-5.1
ti-chi-bot Feb 10, 2022
f79b776
Merge branch 'release-5.1' into release-5.1
ti-chi-bot Feb 10, 2022
271e4c8
modify test
winoros Feb 10, 2022
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
6 changes: 3 additions & 3 deletions cmd/explaintest/r/subquery.result
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Projection 5.00 root Column#22
├─TableReader(Build) 5.00 root data:TableFullScan
│ └─TableFullScan 5.00 cop[tikv] table:t keep order:false
└─StreamAgg(Probe) 1.00 root funcs:count(1)->Column#21
└─IndexJoin 0.22 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)
├─IndexReader(Build) 0.45 root index:IndexRangeScan
│ └─IndexRangeScan 0.45 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) eq(test.t.c, 1) eq(test.t.d, test.t.a)], keep order:false
└─IndexJoin 0.50 root inner join, inner:TableReader, outer key:test.t.a, inner key:test.t.a, equal cond:eq(test.t.a, test.t.a)
├─IndexReader(Build) 1.00 root index:IndexRangeScan
│ └─IndexRangeScan 1.00 cop[tikv] table:s, index:idx(b, c, d) range: decided by [eq(test.t.b, 1) eq(test.t.c, 1) eq(test.t.d, test.t.a)], keep order:false
└─TableReader(Probe) 1.00 root data:TableRangeScan
└─TableRangeScan 1.00 cop[tikv] table:t1 range: decided by [test.t.a], keep order:false
drop table if exists t;
Expand Down
16 changes: 9 additions & 7 deletions executor/analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ func (s *testFastAnalyze) TestFastAnalyze(c *C) {
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a int primary key, b int, c char(10), index index_b(b))")
tk.MustExec("set @@session.tidb_enable_fast_analyze=1")
tk.MustExec("set @@session.tidb_build_stats_concurrency=1")
tk.MustExec("set @@session.tidb_enable_fast_analyze = 1")
tk.MustExec("set @@session.tidb_build_stats_concurrency = 1")
tk.MustExec("set @@tidb_analyze_version = 1")
// Should not panic.
tk.MustExec("analyze table t")
Expand Down Expand Up @@ -564,7 +564,7 @@ func (s *testSerialSuite2) TestAnalyzeIndex(c *C) {
tk.MustExec("drop table if exists t1")
tk.MustExec("create table t1 (id int, v int, primary key(id), index k(v))")
tk.MustExec("insert into t1(id, v) values(1, 2), (2, 2), (3, 2), (4, 2), (5, 1), (6, 3), (7, 4)")
tk.MustExec("set @@tidb_analyze_version=1")
tk.MustExec("set @@tidb_analyze_version = 1")
tk.MustExec("analyze table t1 index k")
c.Assert(len(tk.MustQuery("show stats_buckets where table_name = 't1' and column_name = 'k' and is_index = 1").Rows()), Greater, 0)
tk.MustExec("set @@tidb_analyze_version=default")
Expand All @@ -574,8 +574,8 @@ func (s *testSerialSuite2) TestAnalyzeIndex(c *C) {
func() {
defer tk.MustExec("set @@session.tidb_enable_fast_analyze=0")
tk.MustExec("drop stats t1")
tk.MustExec("set @@session.tidb_enable_fast_analyze=1")
tk.MustExec("set @@tidb_analyze_version=1")
tk.MustExec("set @@session.tidb_enable_fast_analyze = 1")
tk.MustExec("set @@tidb_analyze_version = 1")
tk.MustExec("analyze table t1 index k")
c.Assert(len(tk.MustQuery("show stats_buckets where table_name = 't1' and column_name = 'k' and is_index = 1").Rows()), Greater, 1)
}()
Expand Down Expand Up @@ -863,7 +863,7 @@ func (s *testSuite1) TestNormalAnalyzeOnCommonHandle(c *C) {
tk.MustExec("insert into t3 values(1,1,1), (2,2,2), (3,3,3)")

// Version2 is tested in TestStatsVer2.
tk.MustExec("set@@tidb_analyze_version=1")
tk.MustExec("set@@tidb_analyze_version = 1")
tk.MustExec("analyze table t1, t2, t3")

tk.MustQuery(`show stats_buckets where table_name in ("t1", "t2", "t3")`).Sort().Check(testkit.Rows(
Expand Down Expand Up @@ -913,6 +913,8 @@ func (s *testSuite1) TestDefaultValForAnalyze(c *C) {
for i := 1; i < 4; i++ {
tk.MustExec("insert into t values (?)", i)
}
tk.MustQuery("select @@tidb_analyze_version").Check(testkit.Rows("1"))
tk.MustQuery("select @@session.tidb_analyze_version").Check(testkit.Rows("1"))
tk.MustQuery("select @@tidb_enable_fast_analyze").Check(testkit.Rows("0"))
tk.MustQuery("select @@session.tidb_enable_fast_analyze").Check(testkit.Rows("0"))
tk.MustExec("analyze table t with 0 topn;")
Expand Down Expand Up @@ -956,7 +958,7 @@ func (s *testSerialSuite2) TestIssue20874(c *C) {
tk.MustExec("delete from mysql.stats_histograms")
tk.MustExec("create table t (a char(10) collate utf8mb4_unicode_ci not null, b char(20) collate utf8mb4_general_ci not null, key idxa(a), key idxb(b))")
tk.MustExec("insert into t values ('#', 'C'), ('$', 'c'), ('a', 'a')")
tk.MustExec("set @@tidb_analyze_version=1")
tk.MustExec("set @@tidb_analyze_version = 1")
tk.MustExec("analyze table t")
tk.MustQuery("show stats_buckets where db_name = 'test' and table_name = 't'").Sort().Check(testkit.Rows(
"test t a 0 0 1 1 \x02\xd2 \x02\xd2 0",
Expand Down
4 changes: 2 additions & 2 deletions planner/core/testdata/analyze_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,14 @@
{
"Name": "TestAnalyze",
"Cases": [
"Analyze{Table(_tidb_rowid, a, b, _tidb_rowid)}",
"Analyze{Index(a),Table(a, b)}",
"TableReader(Table(t)->Sel([le(test.t.a, 2)]))",
"IndexReader(Index(t.b)[[-inf,2)])",
"TableReader(Table(t)->Sel([eq(test.t.a, 1) le(test.t.b, 2)]))",
"TableReader(Table(t1)->Sel([le(test.t1.a, 2)]))",
"IndexLookUp(Index(t1.a)[[1,1]], Table(t1)->Sel([le(test.t1.b, 2)]))",
"TableReader(Table(t2)->Sel([le(test.t2.a, 2)]))",
"Analyze{Table(_tidb_rowid, a, b, _tidb_rowid)}",
"Analyze{Index(a),Index(b)}",
"PartitionUnionAll{TableReader(Table(t4)->Sel([le(test.t4.a, 2)]))->TableReader(Table(t4)->Sel([le(test.t4.a, 2)]))}",
"PartitionUnionAll{IndexReader(Index(t4.b)[[-inf,2)])->IndexReader(Index(t4.b)[[-inf,2)])}",
"TableReader(Table(t4)->Sel([eq(test.t4.a, 1) le(test.t4.b, 2)]))"
Expand Down
Loading