--source include/have_innodb.inc
|
|
set @@optimizer_use_condition_selectivity=4;
|
set @@use_stat_tables=PREFERABLY;
|
|
create table t1 (a int)engine=InnoDB;
|
insert into t1 values (1),(1),(2),(3);
|
|
MariaDB [test]> analyze table t1;
|
+---------+---------+----------+-----------------------------------------+
|
| Table | Op | Msg_type | Msg_text |
|
+---------+---------+----------+-----------------------------------------+
|
| test.t1 | analyze | status | Engine-independent statistics collected |
|
| test.t1 | analyze | status | OK |
|
+---------+---------+----------+-----------------------------------------+
|
|
alter table t1 change a b int;
|
|
MariaDB [test]> analyze table t1;
|
+---------+---------+----------+----------------------------------------------------+
|
| Table | Op | Msg_type | Msg_text |
|
+---------+---------+----------+----------------------------------------------------+
|
| test.t1 | analyze | status | Engine-independent statistics collected |
|
| test.t1 | analyze | Note | Data truncated for column 'avg_frequency' at row 1 |
|
| test.t1 | analyze | status | OK |
|
+---------+---------+----------+----------------------------------------------------+
|
|
select * from mysql.column_stats;
|
drop table t1;
|
So here we see a truncation that happens due
rounding off (we should suppress this because the user doesn't expects this)
But we should be throwing a warning if we have an overflow.
The current situations is like for ANALYZE command we don't make a choice if we want to throw a warning on truncation or not. The above case happens due to the bug MDEV-17778. So this MDEV is about making the choice as to if we want to throw warning or errors for truncation or overflow while calculating the statistics