summaryrefslogtreecommitdiff
path: root/sql/ha_innobase.cc
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-12-17 12:17:07 +0200
committerunknown <heikki@donna.mysql.fi>2001-12-17 12:17:07 +0200
commit56a8ad593e0f951b639b4978d5124b2424defe07 (patch)
tree9b9ff300476c4df6b4b37067d7159cf921df81e1 /sql/ha_innobase.cc
parent85a8f75a7d52e9c37f787a2dbea496e73a2e0043 (diff)
downloadmariadb-git-56a8ad593e0f951b639b4978d5124b2424defe07.tar.gz
ha_innobase.cc:
Do not automatically calculate new statistics when a temporary table is used by MySQL in a query. The fact that some ORDER BY queries were slow may have been explained by this unnecessary statistics calculation. sql/ha_innobase.cc: Do not automatically calculate new statistics when a temporary table is used by MySQL in a query. The fact that some ORDER BY queries were slow may have been explained by this unnecessary statistics calculation.
Diffstat (limited to 'sql/ha_innobase.cc')
-rw-r--r--sql/ha_innobase.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc
index 093d4e91c30..81c28605eb7 100644
--- a/sql/ha_innobase.cc
+++ b/sql/ha_innobase.cc
@@ -3035,15 +3035,18 @@ ha_innobase::estimate_number_of_rows(void)
DBUG_ENTER("info");
- dict_update_statistics(prebuilt->table);
-
index = dict_table_get_first_index_noninline(prebuilt->table);
data_file_length = ((ulonglong) index->stat_n_leaf_pages)
* UNIV_PAGE_SIZE;
- /* Calculate a minimum length for a clustered index record */
- estimate = data_file_length / dict_index_calc_min_rec_len(index);
+ /* Calculate a minimum length for a clustered index record and from
+ that an upper bound for the number of rows. Since we only calculate
+ new statistics in row0mysql.c when a table size has grown by 50 %
+ or by a threshold factor, we must add a safety factor 2 in front
+ of the formula below. */
+
+ estimate = 2 * data_file_length / dict_index_calc_min_rec_len(index);
if (prebuilt->trx) {
prebuilt->trx->op_info = "";