diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2016-09-28 16:12:58 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2016-09-28 16:12:58 +0300 |
commit | a53f3c6d3cfa50b15b1aff26bc9479eb582d8611 (patch) | |
tree | 6f3027579072cca80cefb5ecca0aff94fad5d64b /sql/signal_handler.cc | |
parent | 5bbe929d706e26cb3f9b291da6009526a17b1545 (diff) | |
download | mariadb-git-a53f3c6d3cfa50b15b1aff26bc9479eb582d8611.tar.gz |
MDEV-10649: Optimizer sometimes use "index" instead of "range" access for UPDATE
(Fixing both InnoDB and XtraDB)
Re-opening a TABLE object (after e.g. FLUSH TABLES or open table cache
eviction) causes ha_innobase to call
dict_stats_update(DICT_STATS_FETCH_ONLY_IF_NOT_IN_MEMORY).
Inside this call, the following is done:
dict_stats_empty_table(table);
dict_stats_copy(table, t);
On the other hand, commands like UPDATE make this call to get the "rows in
table" statistics in table->stats.records:
ha_innobase->info(HA_STATUS_VARIABLE|HA_STATUS_NO_LOCK)
note the HA_STATUS_NO_LOCK parameter. It means, no locks are taken by
::info() If the ::info() call happens between dict_stats_empty_table
and dict_stats_copy calls, the UPDATE's optimizer will get an estimate
of table->stats.records=1, which causes it to pick a full table scan,
which in turn will take a lot of row locks and cause other bad
consequences.
Diffstat (limited to 'sql/signal_handler.cc')
0 files changed, 0 insertions, 0 deletions