#At file:///usr/local/devel/bzrroot/server/mysql-5.1-innodb/ based on revid:vasil.dimov@stripped
3618 Vasil Dimov 2010-09-30
Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a simple optimization issue. All stats are related to only indexed
columns, index size or number of rows in the whole table. UPDATEs that touch
only non-indexed columns cannot affect stats and we can avoid calling the
function row_update_statistics_if_needed() which may result in unnecessary I/O.
Approved by: Marko (rb://466)
modified:
storage/innobase/row/row0mysql.c
storage/innodb_plugin/row/row0mysql.c
=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c revid:vasil.dimov@stripped
+++ b/storage/innobase/row/row0mysql.c revid:vasil.dimov@stripped
@@ -1447,7 +1447,12 @@ run_again:
srv_n_rows_updated++;
}
- row_update_statistics_if_needed(prebuilt->table);
+ /* We update table statistics only if it is a DELETE or UPDATE
+ that changes indexed columns, UPDATEs that change only non-indexed
+ columns would not affect statistics. */
+ if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
+ row_update_statistics_if_needed(prebuilt->table);
+ }
trx->op_info = "";
=== modified file 'storage/innodb_plugin/row/row0mysql.c'
--- a/storage/innodb_plugin/row/row0mysql.c revid:vasil.dimov@stripped
+++ b/storage/innodb_plugin/row/row0mysql.c revid:vasil.dimov@stripped
@@ -1422,7 +1422,12 @@ run_again:
srv_n_rows_updated++;
}
- row_update_statistics_if_needed(prebuilt->table);
+ /* We update table statistics only if it is a DELETE or UPDATE
+ that changes indexed columns, UPDATEs that change only non-indexed
+ columns would not affect statistics. */
+ if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
+ row_update_statistics_if_needed(prebuilt->table);
+ }
trx->op_info = "";
Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20100930124844-yglojy7c3vaji6dx.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-innodb branch (vasil.dimov:3618) Bug#56340 | vasil.dimov | 30 Sep |