Commit e98bb64c authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-4750: (patch#2): undo previous attempts to stabilize

  persistent table statistics with ANALYZE TABLE commands
parent 6baf3e13
...@@ -4,12 +4,6 @@ CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11), ...@@ -4,12 +4,6 @@ CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB; FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%'; WHERE t1.name LIKE 'A%';
......
...@@ -84,7 +84,6 @@ a+0 ...@@ -84,7 +84,6 @@ a+0
2 2
3 3
alter table t1 add key (a); alter table t1 add key (a);
analyze table t1;
explain select a+0 from t1; explain select a+0 from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 2 NULL 4 Using index 1 SIMPLE t1 index NULL a 2 NULL 4 Using index
...@@ -103,7 +102,6 @@ insert into t1 values ...@@ -103,7 +102,6 @@ insert into t1 values
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499), (116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403), (30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
(44, 307), (68, 454), (57, 135); (44, 307), (68, 454), (57, 135);
analyze table t1;
explain select a+0 from t1; explain select a+0 from t1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 38 Using index 1 SIMPLE t1 index NULL a 5 NULL 38 Using index
......
...@@ -15,9 +15,6 @@ CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11), ...@@ -15,9 +15,6 @@ CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B'); INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3); INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
ANALYZE TABLE t1;
ANALYZE TABLE t2;
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE t1.name LIKE 'A%'; WHERE t1.name LIKE 'A%';
......
...@@ -50,9 +50,6 @@ create table t1 (a bit(2)) engine=innodb; ...@@ -50,9 +50,6 @@ create table t1 (a bit(2)) engine=innodb;
insert into t1 values (b'00'), (b'01'), (b'10'), (b'100'); insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
select a+0 from t1; select a+0 from t1;
alter table t1 add key (a); alter table t1 add key (a);
--disable_result_log
analyze table t1;
--enable_result_log
explain select a+0 from t1; explain select a+0 from t1;
select a+0 from t1; select a+0 from t1;
drop table t1; drop table t1;
...@@ -65,9 +62,6 @@ insert into t1 values ...@@ -65,9 +62,6 @@ insert into t1 values
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499), (116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403), (30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
(44, 307), (68, 454), (57, 135); (44, 307), (68, 454), (57, 135);
--disable_result_log
analyze table t1;
--enable_result_log
explain select a+0 from t1; explain select a+0 from t1;
select a+0 from t1; select a+0 from t1;
explain select b+0 from t1; explain select b+0 from t1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment