diff options
author | heikki@donna.mysql.fi <> | 2001-08-09 20:41:20 +0300 |
---|---|---|
committer | heikki@donna.mysql.fi <> | 2001-08-09 20:41:20 +0300 |
commit | 6e553a2c65da4dbdeef698ba74cd52e2fe2aebce (patch) | |
tree | 0d7f628600c54442074d394e119cdeef58bca998 /innobase | |
parent | d05efc00341f16600b2e0f81e03489537ef77995 (diff) | |
download | mariadb-git-6e553a2c65da4dbdeef698ba74cd52e2fe2aebce.tar.gz |
btr0cur.c Improve range size estimate for big ranges
ha_innobase.cc Fix Sort aborted bug
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/btr/btr0cur.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index e8ff88c6f4f..47a67d425cd 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -2351,6 +2351,7 @@ btr_estimate_n_rows_in_range( btr_path_t* slot1; btr_path_t* slot2; ibool diverged; + ulint divergence_level; ulint n_rows; ulint i; mtr_t mtr; @@ -2393,6 +2394,7 @@ btr_estimate_n_rows_in_range( n_rows = 1; diverged = FALSE; + divergence_level = 1000000; for (i = 0; ; i++) { ut_ad(i < BTR_PATH_ARRAY_N_SLOTS); @@ -2403,6 +2405,13 @@ btr_estimate_n_rows_in_range( if (slot1->nth_rec == ULINT_UNDEFINED || slot2->nth_rec == ULINT_UNDEFINED) { + if (i > divergence_level + 1) { + /* In trees whose height is > 1 our algorithm + tends to underestimate: multiply the estimate + by 2: */ + + n_rows = n_rows * 2; + } return(n_rows); } @@ -2417,6 +2426,8 @@ btr_estimate_n_rows_in_range( return(10); } + divergence_level = i; + diverged = TRUE; } else if (diverged) { n_rows = (n_rows * (slot1->n_recs + slot2->n_recs)) |