Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
Description
It is expected that the range estimates that InnoDB returns from records_in_range call are not exact. Returning about 2x more or 2x less than actual value is considered to be still ok.
However, we are observing a 4.8x difference on a fairly large table. Unfortunately, the table is at the customer site and cannot be provided here.
Attachments
Issue Links
- causes
-
MDEV-35457 Remove btr_cur_t::path_arr
-
- Closed
-
- relates to
-
MDEV-17111 Estimates are low for a condition that satisfies all the rows of an INNODB table
-
- Closed
-
-
MDEV-19424 InnoDB's records_in_range estimates are capped at about 50%
-
- Closed
-
-
MDEV-29835 Partial server freeze
-
- Closed
-
-
MDEV-30148 Race condition between non-persistent statistics and purge of InnoDB history
-
- Closed
-
-
MDEV-20169 main.partition_innodb fails in buildbot with wrong result
-
- Closed
-
-
MDEV-21895 Refactor handler::records_in_range()
-
- Stalled
-
-
MDEV-30637 Mariadb server hangs
-
- Closed
-
-
MDEV-30648 btr_estimate_n_rows_in_range() accesses unfixed, unlatched page
-
- Closed
-
psergei,
> what are p1 and p2 there?
p1 and p2 are cursors, which are used to find 'aaa' and 'zzz' leaves in b-tree.
> Looking at slides #18 and #19... so, for records_in_range('aaa', 'zzz') the code will obtain latches for all pages that hold values between 'aaa' and 'zzz' ? Even if that is thousands of pages?
No, there is some limit on pages count(9 pages) for per-level walking, if the right page is not reached and the the limit was exceeded, the number of rows is estimated approximately by some formula, otherwise the estimation is exact. See btr_estimate_n_rows_in_range_on_level(), it has quite detailed description.
And, as you can see on the slides, the latches are released when we leave some page. The maximum amount of latched pages(red rectangles in the slides) at the same time is 4.