Commit 86055e42 authored by Elena Stepanova's avatar Elena Stepanova Committed by Sergei Golubchik

MDEV-33913 TABLE_STATISTICS increments ROWS_CHANGED twice upon UPDATE and does not count DELETE

parent 94033fcf
......@@ -39,6 +39,9 @@ id first_name last_name address phone email
select * from just_a_test force index(primary) where id=8;
id first_name last_name address phone email
update just_a_test set first_name="unlucky" where id=5;
select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES
test just_a_test 31 6 6 5 1 0 4 1
delete from just_a_test where id=5;
select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES ROWS_INSERTED ROWS_UPDATED ROWS_DELETED KEY_READ_HITS KEY_READ_MISSES
......
......@@ -27,6 +27,7 @@ select * from information_schema.index_statistics where table_schema='test' and
select * from just_a_test force index(primary) where id between 1 and 2;
select * from just_a_test force index(primary) where id=8;
update just_a_test set first_name="unlucky" where id=5;
select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
delete from just_a_test where id=5;
select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
......
......@@ -48,7 +48,7 @@ static int table_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
continue;
rows_changed= (rows_stats->inserted + rows_stats->updated +
rows_stats->updated);
rows_stats->deleted);
table->field[0]->store(table_stats->table, schema_length,
system_charset_info);
table->field[1]->store(table_stats->table + schema_length+1,
......
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