summaryrefslogtreecommitdiff
path: root/innobase/btr
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-02-11 13:48:59 +0200
committerunknown <monty@hundin.mysql.fi>2002-02-11 13:48:59 +0200
commite0ccdc17a208abb21cf15e7fbbbc3b88b969e0ec (patch)
treeada172b5dc5dccd546e301548aac618812e19814 /innobase/btr
parentaf932b5db200407cb250d6e398383e8db387e680 (diff)
parent501650c5b16a4c7cf7b673b19f9a2ae9c319e24f (diff)
downloadmariadb-git-e0ccdc17a208abb21cf15e7fbbbc3b88b969e0ec.tar.gz
merge with 3.23.48
BUILD/FINISH.sh: Auto merged BUILD/SETUP.sh: Auto merged BUILD/compile-alpha: Auto merged BUILD/compile-pentium-gcov: Auto merged BUILD/compile-pentium-gprof: Auto merged BUILD/compile-pentium: Auto merged BitKeeper/deleted/.del-my_new.cc: Delete: mysys/my_new.cc Build-tools/Do-compile: Auto merged acconfig.h: Auto merged acinclude.m4: Auto merged Docs/manual.texi: Auto merged bdb/dist/configure.in: Auto merged client/Makefile.am: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/fil/fil0fil.c: Auto merged innobase/include/srv0srv.h: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0purge.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/t/join.test: Auto merged mysys/Makefile.am: Auto merged scripts/Makefile.am: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/my_lock.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged support-files/my-huge.cnf.sh: Auto merged support-files/my-large.cnf.sh: Auto merged support-files/my-medium.cnf.sh: Auto merged support-files/my-small.cnf.sh: Auto merged configure.in: merge innobase/row/row0mysql.c: merge innobase/trx/trx0trx.c: merge mysql-test/r/innodb.result: merge mysql-test/r/join.result: merge sql/ha_innodb.cc: merge sql/slave.cc: merge
Diffstat (limited to 'innobase/btr')
-rw-r--r--innobase/btr/btr0cur.c20
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);
}