diff options
Diffstat (limited to 'mysql-test/r/statistics.result')
-rw-r--r-- | mysql-test/r/statistics.result | 205 |
1 files changed, 171 insertions, 34 deletions
diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index e3f4d6bf564..ba0390f98db 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -499,14 +499,9 @@ test t1 f 1 5 0.2000 1.0000 6.4000 SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 -test t1 idx1 1 6.4000 -test t1 idx1 2 1.6875 test t1 idx2 1 7.0000 test t1 idx2 2 2.3846 test t1 idx3 1 8.5000 -test t1 idx4 1 6.2000 -test t1 idx4 2 1.6875 -test t1 idx4 3 1.1304 ALTER TABLE t1 CHANGE COLUMN x b varchar(32); SHOW CREATE TABLE t1; Table Create Table @@ -590,14 +585,9 @@ test t1 f 1 5 0.2000 1.0000 6.4000 SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency test t1 PRIMARY 1 1.0000 -test t1 idx4 3 1.1304 -test t1 idx4 2 1.6875 test t1 idx2 1 7.0000 test t1 idx2 2 2.3846 test t1 idx3 1 8.5000 -test t1 idx4 1 6.2000 -test t1 idx1 2 1.6875 -test t1 idx1 1 6.4000 ALTER TABLE t1 CHANGE COLUMN x b varchar(32); SHOW CREATE TABLE t1; Table Create Table @@ -943,6 +933,7 @@ test t1 idx4 3 1.1304 CREATE TABLE t2 LIKE t1; ALTER TABLE t2 ENGINE=InnoDB; INSERT INTO t2 SELECT * FROM t1; +set optimizer_switch='extended_keys=off'; ANALYZE TABLE t2; Table Op Msg_type Msg_text test.t2 analyze status OK @@ -987,6 +978,142 @@ test t2 idx4 3 1.1304 DELETE FROM mysql.table_stats; DELETE FROM mysql.column_stats; DELETE FROM mysql.index_stats; +set optimizer_switch='extended_keys=on'; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM mysql.table_stats; +db_name table_name cardinality +test t2 40 +SELECT * FROM mysql.column_stats ORDER BY column_name; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency +test t2 a 0 49 0.0000 4.0000 1.0000 +test t2 b vvvvvvvvvvvvv zzzzzzzzzzzzzzzzzz 0.2000 17.1250 6.4000 +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 +test t2 f 1 5 0.2000 1.0000 6.4000 +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 PRIMARY 1 1.0000 +test t2 idx1 1 6.4000 +test t2 idx1 2 1.6875 +test t2 idx1 3 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx2 3 1.0000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.6875 +test t2 idx4 3 1.1304 +test t2 idx4 4 1.0000 +ALTER TABLE t2 DROP PRIMARY KEY, DROP INDEX idx1; +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx3 1 8.5000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.6875 +test t2 idx4 3 1.1304 +UPDATE t2 SET b=0 WHERE b IS NULL; +ALTER TABLE t2 ADD PRIMARY KEY (a,b); +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx3 1 8.5000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.6875 +test t2 idx4 3 1.1304 +ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 PRIMARY 1 1.0000 +test t2 PRIMARY 2 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx2 3 1.0000 +test t2 idx2 4 1.0000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx3 3 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.7222 +test t2 idx4 3 1.1154 +test t2 idx4 4 1.0000 +ALTER TABLE t2 CHANGE COLUMN b b varchar(30); +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx3 1 8.5000 +ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 PRIMARY 1 1.0000 +test t2 PRIMARY 2 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx2 3 1.0000 +test t2 idx2 4 1.0000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx3 3 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.7222 +test t2 idx4 3 1.1154 +test t2 idx4 4 1.0000 +ALTER TABLE t2 CHANGE COLUMN b b varchar(32); +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx3 1 8.5000 +ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 PRIMARY 1 1.0000 +test t2 PRIMARY 2 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx2 3 1.0000 +test t2 idx2 4 1.0000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx3 3 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 1.7222 +test t2 idx4 3 1.1154 +test t2 idx4 4 1.0000 +ALTER TABLE t2 DROP COLUMN b; +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx3 1 8.5000 +ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; +db_name table_name index_name prefix_arity avg_frequency +test t2 PRIMARY 1 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx2 3 1.0000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 2.2308 +test t2 idx4 3 1.0000 +set optimizer_switch='extended_keys=off'; ALTER TABLE t1 DROP INDEX idx1, DROP INDEX idx4; @@ -994,11 +1121,34 @@ ALTER TABLE t1 MODIFY COLUMN b text, ADD INDEX idx1 (b(4), e), ADD INDEX idx4 (e, b(4), d); +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency +test t2 a 0 49 0.0000 4.0000 1.0000 +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 +test t2 f 1 5 0.2000 1.0000 6.4000 +SELECT * FROM mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx2 3 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 +test t2 idx4 3 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 2.2308 +test t2 PRIMARY 1 1.0000 ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status OK SELECT * FROM mysql.column_stats; db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency +test t2 a 0 49 0.0000 4.0000 1.0000 +test t2 c aaaa dddddddd 0.1250 6.6571 7.0000 +test t2 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 +test t2 e 0.01 0.112 0.2250 8.0000 6.2000 +test t2 f 1 5 0.2000 1.0000 6.4000 test t1 a 0 49 0.0000 4.0000 1.0000 test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 @@ -1007,9 +1157,18 @@ test t1 f 1 5 0.2000 1.0000 6.4000 test t1 b NULL NULL 0.2000 17.1250 NULL SELECT * FROM mysql.index_stats; db_name table_name index_name prefix_arity avg_frequency -test t1 PRIMARY 1 1.0000 -test t1 idx3 1 8.5000 +test t2 idx3 1 8.5000 +test t2 idx3 2 1.0000 +test t2 idx2 3 1.0000 +test t2 idx2 1 7.0000 +test t2 idx2 2 2.3846 test t1 idx2 1 7.0000 +test t1 idx3 1 8.5000 +test t1 PRIMARY 1 1.0000 +test t2 idx4 3 1.0000 +test t2 idx4 1 6.2000 +test t2 idx4 2 2.2308 +test t2 PRIMARY 1 1.0000 test t1 idx2 2 2.3846 test t1 idx1 1 NULL test t1 idx1 2 NULL @@ -1057,28 +1216,6 @@ test t1 idx1 2 NULL test t1 idx4 1 6.2000 test t1 idx4 2 NULL test t1 idx4 3 NULL -SELECT * FROM mysql.table_stats; -db_name table_name cardinality -test t1 40 -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency -test t1 a 0 49 0.0000 4.0000 1.0000 -test t1 c aaaa dddddddd 0.1250 6.6571 7.0000 -test t1 d 1989-03-12 1999-07-23 0.1500 3.0000 8.5000 -test t1 e 0.01 0.112 0.2250 8.0000 6.2000 -test t1 f 1 5 0.2000 1.0000 6.4000 -test t1 b NULL NULL 0.2000 17.1250 NULL -SELECT * FROM mysql.index_stats; -db_name table_name index_name prefix_arity avg_frequency -test t1 PRIMARY 1 1.0000 -test t1 idx3 1 8.5000 -test t1 idx2 1 7.0000 -test t1 idx2 2 2.3846 -test t1 idx1 1 NULL -test t1 idx1 2 NULL -test t1 idx4 1 6.2000 -test t1 idx4 2 NULL -test t1 idx4 3 NULL DELETE FROM mysql.table_stats; DELETE FROM mysql.column_stats; DELETE FROM mysql.index_stats; |