Description:
For MySQL, when the number of tables is changed to more than 10%, statistics update is triggered and the table is sent to dict_stats_thread to update statistics. However, table objects in the memory are eliminated. If multiple tables are updated, statistics may fail to be updated for a long time.
void row_update_statistics_if_needed(dict_table_t *table) /*!< in: table */
{
ib_uint64_t counter;
ib_uint64_t n_rows;
...
counter = table->stat_modified_counter++;
n_rows = dict_table_get_n_rows(table);
if (dict_stats_is_persistent_enabled(table)) {
double recalc_pct = rds_recalc_persistent_stats_threshold_pct / 100;
if (counter > (n_rows * recalc_pct) &&
dict_stats_auto_recalc_is_enabled(table)) {
dict_stats_recalc_pool_add(table);
table->stat_modified_counter = 0;
}
return;
}
The dict_table_t may be removed from the cache.
How to repeat:
1.create table
2.insert values
3.flush table
4.insert values
5.flush table
6.Check statistics.We can see that the statistics of the table are not updated.