diff options
author | unknown <heikki@donna.mysql.fi> | 2002-01-30 16:29:15 +0200 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2002-01-30 16:29:15 +0200 |
commit | baa10db17d5f3b489b8c9da7cf5b353a93bda694 (patch) | |
tree | 91cf9539bdee7bc48026ad33982806036f738815 /innobase/btr | |
parent | 37cebe2a1b6dc230a6cc0b45b6e818d520bb441a (diff) | |
download | mariadb-git-baa10db17d5f3b489b8c9da7cf5b353a93bda694.tar.gz |
btr0cur.c, ha_innobase.cc:
Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity
sql/ha_innobase.cc:
Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity
innobase/btr/btr0cur.c:
Fine-tune optimization parameters; in small tables the estimates are accurate; in big tables let us not be too optimistic about index selectivity
Diffstat (limited to 'innobase/btr')
-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 da51be11176..a078c843159 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); } |