mirror of
https://github.com/MariaDB/server.git
synced 2026-04-28 19:25:32 +02:00
Fix for BUG#16710.
The bug was due to a missed case in the detection of whether an index can be used for loose scan. More precisely, the range optimizer chose to use loose index scan for queries for which the condition(s) over an index key part could not be pushed to the index together with the loose scan. As a result, loose index scan was selecting the first row in the index with a given GROUP BY prefix, and was applying the WHERE clause after that, while it should have inspected all rows with the given prefix, and apply the WHERE clause to all of them. The fix detects and skips such cases. mysql-test/r/group_min_max.result: Added test for BUG#16710. mysql-test/t/group_min_max.test: Added test for BUG#16710. sql/item.cc: Added new method [Item | Item_field]::find_item_in_field_list_processor. sql/item.h: Added new method [Item | Item_field]::find_item_in_field_list_processor. sql/opt_range.cc: Handle the case when there is no MIN/MAX aggregate function, and a keypart of the index being considered, that is after the GROUP BY prefix, is used in the WHERE clause and the condition where it is used cannot be pushed to the index. If this is the case, we rule out this index.
This commit is contained in:
parent
82f645531c
commit
a01d48f92e
5 changed files with 78 additions and 1 deletions
|
|
@ -699,6 +699,7 @@ public:
|
|||
virtual bool remove_fixed(byte * arg) { fixed= 0; return 0; }
|
||||
virtual bool cleanup_processor(byte *arg);
|
||||
virtual bool collect_item_field_processor(byte * arg) { return 0; }
|
||||
virtual bool find_item_in_field_list_processor(byte *arg) { return 0; }
|
||||
virtual bool change_context_processor(byte *context) { return 0; }
|
||||
virtual bool reset_query_id_processor(byte *query_id) { return 0; }
|
||||
|
||||
|
|
@ -1146,6 +1147,7 @@ public:
|
|||
bool is_null() { return field->is_null(); }
|
||||
Item *get_tmp_table_item(THD *thd);
|
||||
bool collect_item_field_processor(byte * arg);
|
||||
bool find_item_in_field_list_processor(byte *arg);
|
||||
bool reset_query_id_processor(byte *arg)
|
||||
{
|
||||
field->query_id= *((query_id_t *) arg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue