1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

MDEV-3818: Query against view over IS tables worse than equivalent query without view

Analysis:
The reason for the suboptimal plan when querying IS tables through a view
was that the view columns that participate in an equality are wrapped by
an Item_direct_view_ref and were not recognized as being direct column
references.

Solution:
Use the original Item_field objects via the real_item() method.
This commit is contained in:
unknown
2012-12-17 15:23:58 +02:00
parent a334e87d65
commit d7a0148758
3 changed files with 41 additions and 3 deletions

View File

@@ -3184,13 +3184,13 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
Item_field *item_field;
CHARSET_INFO *cs= system_charset_info;
if (item_func->arguments()[0]->type() == Item::FIELD_ITEM &&
if (item_func->arguments()[0]->real_item()->type() == Item::FIELD_ITEM &&
item_func->arguments()[1]->const_item())
{
idx_field= 0;
idx_val= 1;
}
else if (item_func->arguments()[1]->type() == Item::FIELD_ITEM &&
else if (item_func->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
item_func->arguments()[0]->const_item())
{
idx_field= 1;
@@ -3199,7 +3199,7 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
else
return 0;
item_field= (Item_field*) item_func->arguments()[idx_field];
item_field= (Item_field*) item_func->arguments()[idx_field]->real_item();
if (table->table != item_field->field->table)
return 0;
tmp_str= item_func->arguments()[idx_val]->val_str(&str_buff);