diff options
author | mithun <mithun.c.y@oracle.com> | 2014-05-15 11:46:57 +0530 |
---|---|---|
committer | mithun <mithun.c.y@oracle.com> | 2014-05-15 11:46:57 +0530 |
commit | 4c4def904368dff4acb7a2ce6fbe04afb15cbdad (patch) | |
tree | bb2d882a1528372e5bd3ac8f040aebaab3811234 /storage/blackhole | |
parent | 5228395a310e7f57911a76c1dc1542c0d0df87cb (diff) | |
download | mariadb-git-4c4def904368dff4acb7a2ce6fbe04afb15cbdad.tar.gz |
Bug#17217128 : BAD INTERACTION BETWEEN MIN/MAX AND
"HAVING SUM(DISTINCT)": WRONG RESULTS.
ISSUE:
------
If a query uses loose index scan and it has both
AGG(DISTINCT) and MIN()/MAX()functions. Then, result values
of MIN/MAX() is set improperly.
When query has AGG(DISTINCT) then end_select is set to
end_send_group. "end_send_group" keeps doing aggregation
until it sees a record from next group. And, then it will
send out the result row of that group.
Since query also has MIN()/MAX() and loose index scan is
used, values of MIN/MAX() are set as part of loose index
scan itself. Setting MIN()/MAX() values as part of loose
index scan overwrites values computed in end_send_group.
This caused invalid result.
For such queries to work loose index scan should stop
performing MIN/MAX() aggregation. And, let end_send_group to
do the same. But according to current design loose index
scan can produce only one row per group key. If we have both
MIN() and MAX() then it has to give two records out. This is
not possible as interface has to use common buffer
record[0]! for both records at a time.
SOLUTIONS:
----------
For such queries to work we need a new interface for loose
index scan. Hence, do not choose loose_index_scan for such
cases. So a new rule SA7 is introduced to take care of the
same.
SA7: "If Q has both AGG_FUNC(DISTINCT ...) and
MIN/MAX() functions then loose index scan access
method is not used."
Diffstat (limited to 'storage/blackhole')
0 files changed, 0 insertions, 0 deletions