diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-07-14 12:09:10 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-07-15 11:27:32 +0530 |
commit | dfdfeecb03edaf5660f5e15337381dda6f83102c (patch) | |
tree | f3f29a3323323d6f0d718f843fbe153776dc98c4 /mysql-test | |
parent | 67a03b7c947f5a0cfddbe1acc5e560fc737b0848 (diff) | |
download | mariadb-git-dfdfeecb03edaf5660f5e15337381dda6f83102c.tar.gz |
MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows
An oveflow was happening on windows because on Windows sizeof(ulong) is 4 bytes
while it is 8 bytes on Linux.
Switched avg_frequency and avg length for column statistics to ulonglong.
Switched avg_frequency for index statistics to ulonglong.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/stat_tables_innodb.result | 29 | ||||
-rw-r--r-- | mysql-test/t/stat_tables_innodb.test | 21 |
2 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/r/stat_tables_innodb.result b/mysql-test/r/stat_tables_innodb.result index b8bed681465..5f393dde05e 100644 --- a/mysql-test/r/stat_tables_innodb.result +++ b/mysql-test/r/stat_tables_innodb.result @@ -770,4 +770,33 @@ set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selecti set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; +# +# MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows. +# +CREATE TABLE t1 AS SELECT TABLE_CATALOG FROM INFORMATION_SCHEMA.COLUMNS; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +SET @save_use_stat_tables= @@use_stat_tables; +SET use_stat_tables= preferably; +SELECT count(*) FROM t1; +count(*) +54336 +CREATE INDEX idx ON t1(TABLE_CATALOG); +Warnings: +Warning 1071 Specified key was too long; max key length is 767 bytes +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (TABLE_CATALOG) INDEXES (idx); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM mysql.index_stats where table_name='t1'; +db_name table_name index_name prefix_arity avg_frequency +test t1 idx 1 NULL +SELECT * FROM mysql.column_stats where table_name='t1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 TABLE_CATALOG def def 0.0000 3.0000 54336.0000 0 NULL NULL +SET use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/stat_tables_innodb.test b/mysql-test/t/stat_tables_innodb.test index 04e81de8f9d..e4a11955aba 100644 --- a/mysql-test/t/stat_tables_innodb.test +++ b/mysql-test/t/stat_tables_innodb.test @@ -9,4 +9,25 @@ set optimizer_switch='extended_keys=on'; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; +--echo # +--echo # MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows. +--echo # + +CREATE TABLE t1 AS SELECT TABLE_CATALOG FROM INFORMATION_SCHEMA.COLUMNS; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; + +SET @save_use_stat_tables= @@use_stat_tables; +SET use_stat_tables= preferably; +SELECT count(*) FROM t1; +CREATE INDEX idx ON t1(TABLE_CATALOG); +ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (TABLE_CATALOG) INDEXES (idx); +SELECT * FROM mysql.index_stats where table_name='t1'; +SELECT * FROM mysql.column_stats where table_name='t1'; +SET use_stat_tables= @save_use_stat_tables; +DROP TABLE t1; + SET SESSION STORAGE_ENGINE=DEFAULT; |