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

LP:730133 - Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The following query returns less rows when executed with JKL, BKA and ICP v.s. any other plan. Repeatable in maria-5.3 and maria-5.3-mwl128

      EXPLAIN:

      id select_type table type possible_keys key key_len ref rows Extra
      1 SIMPLE t1 index NULL f4 10 NULL 12 Using index
      1 SIMPLE alias3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
      1 SIMPLE alias2 ref f4 f4 5 test.alias3.f5 2 Using index condition(BKA); Using join buffer (incremental, BKA join)

      bzr version-info:

      revision-id: <email address hidden>
      date: 2011-03-04 18:54:30 +0300
      build-date: 2011-03-06 15:53:17 +0200
      revno: 2933
      branch-nick: maria-5.3

      test case:

      SET SESSION optimizer_use_mrr = 'force';
      SET SESSION join_cache_level = 7;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 ( f1 int, f2 int, f3 int, f4 int, f5 int, KEY (f4,f3)) ;
      INSERT IGNORE INTO t1 VALUES ('2','9','5','0','0'),('4','7','0','0','0'),('6','97','190','0','0'),('7','3','6','0','0'),('11','101','186','0','0'),('14','194','226','0','0'),('15','148','133','0','0'),('16','9','6','0','0'),('17','9','3','0','0'),('18','1','8','0','0'),('19','1','5','0','0'),('20','5','7','0','0');

      --let $query = SELECT COUNT(alias2.f2) FROM t1 STRAIGHT_JOIN ( t1 AS alias2 FORCE KEY (f4) JOIN t1 AS alias3 ON alias3.f5 = alias2.f4 ) ON alias3.f1 < alias2.f3 ;

      SET SESSION optimizer_switch = 'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=on';
      --eval $query
      --eval EXPLAIN $query
      SET SESSION optimizer_switch = 'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=off';
      --eval $query
      --eval EXPLAIN $query

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            psergey Sergei Petrunia added a comment -

            Re: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index
            I've already made several attempts to analyze, and was not successful so far. There is something wrong either with index condition pushdown or with linked BKA, but I wasn't able to narrow down the problem so far.

            Show
            psergey Sergei Petrunia added a comment - Re: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index I've already made several attempts to analyze, and was not successful so far. There is something wrong either with index condition pushdown or with linked BKA, but I wasn't able to narrow down the problem so far.
            Hide
            psergey Sergei Petrunia added a comment -

            Re: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index
            To reproduce with current 5.3, one needs to

            set optimizer_switch='optimize_join_buffer_size=on';

            (the default for the flag was changed to OFF in revno:3111)

            Show
            psergey Sergei Petrunia added a comment - Re: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index To reproduce with current 5.3, one needs to set optimizer_switch='optimize_join_buffer_size=on'; (the default for the flag was changed to OFF in revno:3111)
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 730133

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 730133

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: