Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8024

Remove excessive update_used_tables() calls

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5, 10.0, 10.1
    • Fix Version/s: 10.1.5
    • Component/s: OTHER
    • Labels:
      None

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration