I doubts we can remove virtual status, but we can check how it is called, frequently such functions called several times in a row instead of 1 call with storing result...
Oleksandr Byelkin
added a comment - I doubts we can remove virtual status, but we can check how it is called, frequently such functions called several times in a row instead of 1 call with storing result...
above in most cases is just 2 used_tables() call and it looks like workaround for some unfixed bug
Oleksandr Byelkin
added a comment - - edited
/* Item_subselect in --ps-protocol mode will state it as a non-const */
is_const= args[0]->const_item() || !args[0]->used_tables();
in
sql/item_strfunc.cc|630| is_const= args[0]->const_item() || !args[0]->used_tables();
sql/item_strfunc.cc|642| is_const= args[i]->const_item() || !args[i]->used_tables();
sql/item_strfunc.cc|978| is_const= args[i]->const_item() || !args[i]->used_tables();
above in most cases is just 2 used_tables() call and it looks like workaround for some unfixed bug
Itea: check const_item() calls and if in the class there is used_table_cache use it instead of used_tables() call.
UPDATE: it is not a problem because they have const_item_cache.
Oleksandr Byelkin
added a comment - - edited Itea: check const_item() calls and if in the class there is used_table_cache use it instead of used_tables() call.
UPDATE: it is not a problem because they have const_item_cache.
but it will require heavy enough refactoring of the way how we work now.
In fact now we have 2 ways of getting used tables - precalculation and getting it on the fly. Some dependencies are easy to trace now:
direct arguments
belonging to outer query
Other are more tricky:
constant tables
reference table for NULL
reference on the item (all family of Item_ref)
So the changes of removing 'virtual' from used_tables is movement in the right direction (dependencies are not volatile and changes not so frequently so could be traced) but it is too much refactoring for betta and should be done in next version if gain we get really pay for 1-2 weeks of intensive development.
Now I'd better fix obvious mistakes and make small improvements.
Oleksandr Byelkin
added a comment - I analyzed dependencies of used_tables, in theory it can be changed to
inline table_map used_tables() { return used_tables_cache; }
but it will require heavy enough refactoring of the way how we work now.
In fact now we have 2 ways of getting used tables - precalculation and getting it on the fly. Some dependencies are easy to trace now:
direct arguments
belonging to outer query
Other are more tricky:
constant tables
reference table for NULL
reference on the item (all family of Item_ref)
So the changes of removing 'virtual' from used_tables is movement in the right direction (dependencies are not volatile and changes not so frequently so could be traced) but it is too much refactoring for betta and should be done in next version if gain we get really pay for 1-2 weeks of intensive development.
Now I'd better fix obvious mistakes and make small improvements.
I doubts we can remove virtual status, but we can check how it is called, frequently such functions called several times in a row instead of 1 call with storing result...