Bug #42210 | Partition pruning depends on number of partitions involved in a query | ||
---|---|---|---|
Submitted: | 20 Jan 2009 9:08 | Modified: | 27 Feb 2009 8:55 |
Reporter: | Denis Kukharev | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
Version: | 5.1.28-rc, 5.1.30 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | failed, partitioning, pruning |
[20 Jan 2009 9:08]
Denis Kukharev
[20 Jan 2009 9:09]
Sergey Petrunya
See also BUG#33730
[20 Jan 2009 9:22]
Sergey Petrunya
Denis, thanks for taking time to report this. The dependency is a documented property. At the moment we plan to increase it from 10 to 32 (see BUG#33730 for more details and pointer to the docs.). The thing is, when the optimizer encounters partitioning on a non-analyzable funciton (e.g. HAHS(LogDay)) and a piece of WHERE clause in form LogDay between dayofyear(now())-10 and dayofyear(now())-1 it processes process it by walking through val1= dayofyear(now()) - 10 val2= dayofyear(now()) - 10 + 1 val3= dayofyear(now()) - 10 + 2 . . . valN= dayofyear(now()) - 10 + N = dayofyear(now())-1 and seeing which partitions we hit. Apparently this approach will be too slow to be usable if we applied it for all BETWEEN predicates because someobody could write partitioning_column BETWEEN const1 AND const + 1,000,000 and that would take too long to analyze. So we've had to set a limit somewhere.
[20 Jan 2009 9:32]
Denis Kukharev
Ok, thanx for your kindly explanation. I have seen that similar bug (I couldn't find it in the base until I have posted my one :) ) And as far as I understood, one of the possible solutions was to make it a tunable parameter. Was it considered unacceptable?
[20 Jan 2009 9:40]
Valeriy Kravchuk
I thank that adding a tunable server variable/hint for cases like this is a reasonable feature request.
[20 Jan 2009 11:58]
Denis Kukharev
Yeah, it'd be very convenient, 'cause in my case, for instance, I'd like to scan 2-week periods, but for now, I'm restricted (if I don't want to loose pruning) with 10 days. So, in some cases it may be critical to tune it right to the desired value which would be not too big and quite acceptable by the optimizer but not reachable in case of inappropriate pre-defined constant.
[27 Feb 2009 8:55]
Sergey Petrunya
The problem is resolved by the fix for BUG#33730. Unfortunately we could not put the fix into 5.1 (as it is only a performance issue and 5.1 is already GA), so it will be available only in 6.0. If you really need it in 5.1, the patch in BUG#33730 (you need only the last one) should be apply to 6.0 without any adjustments.
[27 Feb 2009 8:55]
Sergey Petrunya
Marking as duplicate of BUG#33730