diff options
author | unknown <monty@bitch.mysql.fi> | 2002-03-16 11:31:13 +0200 |
---|---|---|
committer | unknown <monty@bitch.mysql.fi> | 2002-03-16 11:31:13 +0200 |
commit | 72d3219c043a1d0a3c1751048bcefb12155836d9 (patch) | |
tree | e75a1c7701356ffcf74891e1b7a4e8ec8c28dfc3 /innobase/btr/btr0cur.c | |
parent | 68441ece22c01a6c45a4e86b76fc54c7ef3485d7 (diff) | |
parent | 52e6db975aaa3787b7083cb51ff7681e66fddbc9 (diff) | |
download | mariadb-git-72d3219c043a1d0a3c1751048bcefb12155836d9.tar.gz |
Merge hundin:/my/mysql-4.0 into bitch.mysql.fi:/my/mysql-4.0
mysql-test/mysql-test-run.sh:
Auto merged
Diffstat (limited to 'innobase/btr/btr0cur.c')
-rw-r--r-- | innobase/btr/btr0cur.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index 9f3d02525d8..d6944ecadc8 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2552,6 +2552,7 @@ btr_estimate_number_of_different_key_vals( ulint total_external_size = 0; ulint i; ulint j; + ulint add_on; mtr_t mtr; n_cols = dict_index_get_n_unique(index); @@ -2624,8 +2625,25 @@ btr_estimate_number_of_different_key_vals( + not_empty_flag) / (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size); - } + /* If the tree is small, smaller than < + 10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then + the above estimate is ok. For bigger trees it is common that we + do not see any borders between key values in the few pages + we pick. But still there may be BTR_KEY_VAL_ESTIMATE_N_PAGES + different key values, or even more. Let us try to approximate + that: */ + + add_on = index->stat_n_leaf_pages / + (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size)); + + if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) { + add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES; + } + + index->stat_n_diff_key_vals[j] += add_on; + } + mem_free(n_diff); } |