1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for MDEV-4140

Analysis:
Range analysis detects that the subquery is expensive and doesn't
build a range access method. Later, the applicability test for loose
scan doesn't take that into account, and builds a loose scan method
without a range scan on the min/max column. As a result loose scan
fetches the first key in each group, rather than the first key that
satisfies the condition on the min/max column.

Solution:
Since there is no SEL_ARG tree to be used for the min/max column,
it is not possible to use loose scan if the min/max column is compared
with an expensive scalar subquery. Make the test for loose scan
applicability to be in sync with the range analysis code by testing if
the min/max argument is compared with an expensive predicate.
This commit is contained in:
unknown
2013-02-13 11:58:16 +02:00
parent 3a0b25bb07
commit d4b1e8f31a
3 changed files with 59 additions and 1 deletions

View File

@ -12236,7 +12236,7 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
&has_min_max, &has_other))
DBUG_RETURN(FALSE);
}
else if (cur_arg->const_item())
else if (cur_arg->const_item() && !cur_arg->is_expensive())
{
/*
For predicates of the form "const OP expr" we also have to check 'expr'