[MDEV-8024] Remove excessive update_used_tables() calls Created: 2015-04-20  Updated: 2015-05-12  Resolved: 2015-05-12

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 10.1.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-7950 Item_func::type() takes 0.26% in OLTP RO Closed

 Description   

In this code in sql_select.cc:

static COND *build_equal_items(JOIN *join, COND *cond,
                               COND_EQUAL *inherited,
                               List<TABLE_LIST> *join_list,
                               bool ignore_on_conds,
                               COND_EQUAL **cond_equal_ref,
                               bool link_equal_fields)
{
  THD *thd= join->thd;
  COND_EQUAL *cond_equal= 0;
 
  if (cond) 
  {
    cond= build_equal_items_for_cond(thd, cond, inherited, link_equal_fields);
    cond->update_used_tables();
  ...

the call for cond->update_used_tables() is not needed in most cases.

Look into all "return" in build_equal_items_for_cond().
update_used_tables() is either not needed at all, like in case when "new Item_int" is returned,
or update_used_tables() is already called inside build_equal_items_for_cond().

This task is to move the call for code->update_used_tables() from build_equal_items() into build_equal_items_for_cond(), and then to get rid of the unnecessary calls in the cases that don't really need it.


Generated at Thu Feb 08 07:24:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.