mariadb/storage/innobase
Vasil Dimov c292616a7d Fix Bug#53761 RANGE estimation for matched rows may be 200 times different
Improve the range estimation algorithm.

Previously:
For a given level the algo knows the number of pages in the requested range and the n

With this change:
Same idea, but peek a few (10) of the intermediate pages to get a better estimate of 

In the bug report one of the examples has a btree with a snippet of the leaf level li
page1(899 records), page2(1 record), page3(1 record), page4(1 record)
so when trying to estimate, the previous algo, assumed there are average (899+1)/2=45
Fix Bug#53761 RANGE estimation for matched rows may be 200 times different

Improve the range estimation algorithm.

Previously:
For a given level the algo knows the number of pages in the requested range
and the number of records on the leftmost and the rightmost page. Then it
assumes all pages in between contain the average between the two border pages
and multiplies this average number by the number of intermediate pages.

With this change:
Same idea, but peek a few (10) of the intermediate pages to get a better
estimate of the average number of records per page. If there are less than 10
intermediate pages then all of them will be scanned and the result will be
precise, not an estimation.

In the bug report one of the examples has a btree with a snippet of the leaf
level like this:
page1(899 records), page2(1 record), page3(1 record), page4(1 record)
so when trying to estimate, the previous algo, assumed there are average
(899+1)/2=450 records per page which went terribly wrong. With this change
page2 and page3 will be read and the exact number of records will be returned.

Approved by:	Sunny (rb://401)
2010-08-16 17:23:29 +03:00
..
btr Fix Bug#53761 RANGE estimation for matched rows may be 200 times different 2010-08-16 17:23:29 +03:00
buf When the caller of buf_flush_list() provides us with the number of 2010-07-30 10:39:16 -04:00
data Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4 2010-06-29 14:32:48 +03:00
dict Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-21 17:22:29 +03:00
dyn Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
eval Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
fil Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
fsp Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
fut Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
ha Currently we do a full validation of AHI whenever check tables is 2010-08-05 11:09:05 -04:00
handler Change default for innodb_strict_mode to FALSE. 2010-08-13 15:07:22 -04:00
ibuf Bug#54914: InnoDB: performance drop with innodb_change_buffering=all 2010-08-10 13:22:48 +03:00
include Fix Bug#53761 RANGE estimation for matched rows may be 200 times different 2010-08-16 17:23:29 +03:00
lock Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
log Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
mach mach_ull_parse_compressed(): Move to .ic file to silence a GCC warning 2010-06-24 09:08:42 +03:00
mem Fix bug #52546, crash on shutdown of plugin with innodb_use_sys_malloc=0. 2010-05-17 01:57:42 -07:00
mtr Remove code that was added during the flush list mutex refactoring. We cannot 2010-07-22 14:46:12 +10:00
mysql-test/patches Move InnoDB tests from storage/innobase/mysql-test/ (where they were ignored) 2010-04-14 14:14:48 +03:00
os Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-21 17:22:29 +03:00
page Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
pars Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
que Remove references to srv0que.h. 2010-05-12 12:20:26 +10:00
read Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
rem Merge from mysql-5.1-innodb: 2010-05-11 19:18:28 +03:00
row Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-21 17:22:29 +03:00
srv Bug#54583 InnoDB: Assertion failure sync/sync0sync.c:1226 2010-07-22 09:16:19 +10:00
sync Bug#54583 InnoDB: Assertion failure sync/sync0sync.c:1226 2010-07-22 09:16:19 +10:00
thr Import branches/innodb+ from SVN on top of storage/innobase. 2010-04-12 18:20:41 +03:00
trx Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4 2010-06-29 14:32:48 +03:00
usr Merge Innodb Plugin 1.0.6 from mysql-5.1-bugteam storage/innodb_plugin to mysql-trunk-merge. 2009-12-02 19:30:50 +05:30
ut Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-21 17:22:29 +03:00
CMakeLists.txt Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-21 17:22:29 +03:00
compile-innodb Update compile-innodb to use cmake and remove the debug version. 2010-04-15 12:33:07 +03:00
COPYING Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
COPYING.Google Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
COPYING.Percona Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
COPYING.Sun_Microsystems Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
Doxyfile Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
ha_innodb.def Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
Makefile.am Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-09 09:28:51 -03:00
plug.in Import branches/innodb+ from SVN on top of storage/innobase. 2010-04-12 18:20:41 +03:00