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

Remove excessive update_used_tables() calls

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.0, 5.5
    • 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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              There are no comments yet on this issue.

                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:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour, 30 minutes
                    1h 30m