Bug #26453 patch to speed up range-optimizer
Submitted: 16 Feb 2007 17:05 Modified: 18 Dec 2008 13:13
Reporter: Martin Friebe (Gold Quality Contributor) (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S5 (Performance)
Version:5.0.36bk OS:Any (*)
Assigned to: CPU Architecture:Any
Tags: Contribution, qc, range optimizer

[16 Feb 2007 17:05] Martin Friebe
Description:
In mi_range.c and mi_search.c, while executing _mi_record_pos for packed keys, the code walks each index node twice.

1st calling *bin_search, to match the key in the node
2nd calling _mi_keynr, to find the position and the total amount.

The position can easily be returned from *bin_search.
In order to find the total amount of keys in the node, it is only needed to continue from the position returned by *bin_search

Doing this saves between 10% and 20% time (of the statistics time) when estimating the range for "key IN(huge list)".

Applying it together with the patch from bug #20944 an overall of up to 30% on those range statistics can be saved.

How to repeat:
-

Suggested fix:
apply the patch
[16 Feb 2007 17:06] Martin Friebe
patch to reduce amount of node scans during range statistic on packed keys

Attachment: range2.patch (text/x-patch), 14.52 KiB.

[18 Feb 2007 17:32] MySQL Verification Team
Thank you for the bug report and the contribution.
[17 Aug 2007 21:57] Igor Babaev
- No CSC is bound to this bug.
- This is not an optimizer optimization. This is an optimization for the MyISAM engine.

I move the bug to 'To be fixed later'.
Product management will decide in what version this optimization appears.
[18 Dec 2008 12:55] Mikhail Izioumtchenko
why is it assigned to me, or rather the question is,
how is it related to InnoDB?