mariadb/storage/xtradb/dict
Sergei Petrunia a53f3c6d3c 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.
2016-09-28 16:12:58 +03:00
..
dict0boot.cc 5.6.24-72.2 2015-06-16 11:04:40 +02:00
dict0crea.cc Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-08-10 19:55:45 +02:00
dict0dict.cc Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-08-10 19:55:45 +02:00
dict0load.cc 5.6.31-77.0 2016-08-10 19:24:58 +02:00
dict0mem.cc Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-08-10 19:55:45 +02:00
dict0stats.cc MDEV-10649: Optimizer sometimes use "index" instead of "range" access for UPDATE 2016-09-28 16:12:58 +03:00
dict0stats_bg.cc 5.6.31-77.0 2016-08-10 19:24:58 +02:00