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

LP:637978 - Wrong result with maria-5.1-wl24 and index_merge / sort_union

    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:

      SELECT COUNT FROM `table100000_myisam_int_autoinc` WHERE ( ( `col_varchar_64_key` = 'i' ) OR `col_varchar_10_key` IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) ) OR ( `pk` BETWEEN 120 AND 79 + 255 OR `col_smallint_key` IN ( 4 , 179 , 1 ) ) AND ( ( `col_smallint_key` > 8 ))

      returns 3212 when executed with index_merge and sort_union in maria-5.1-wl24 and 3379 when executed with maria-5.1 or with IGNORE INDEX and a full table scan.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            philipstoev Philip Stoev added a comment -

            mysqldump of table
            LPexportBug637978_bug637978.dump.zip

            Show
            philipstoev Philip Stoev added a comment - mysqldump of table LPexportBug637978_bug637978.dump.zip
            Hide
            philipstoev Philip Stoev added a comment -

            Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union

            Show
            philipstoev Philip Stoev added a comment - Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union
            Hide
            philipstoev Philip Stoev added a comment -

            Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union
            Shorter, if not prettier, test case:

            --disable_query_log
            --disable_result_log
            CREATE TABLE `table100000_myisam_int_autoinc` (
            `col_smallint_key` smallint(6) DEFAULT NULL,
            `pk` int(11) NOT NULL AUTO_INCREMENT,
            `col_varchar_10_key` varchar(10) DEFAULT NULL,
            `col_varchar_64_key` varchar(64) DEFAULT NULL,
            PRIMARY KEY (`pk`),
            KEY `col_smallint_key` (`col_smallint_key`),
            KEY `col_varchar_10_key` (`col_varchar_10_key`),
            KEY `col_varchar_64_key` (`col_varchar_64_key`)
            ) ENGINE=MyISAM AUTO_INCREMENT=100001 DEFAULT CHARSET=latin1;
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (30371,99001,'dl','e');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (3,99002,'Ohio','t');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (9,99003,'Delaware','xb');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99004,'Pennsylvan','i');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (179,99427,'fliq','because');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (16636,99428,'North Dako','quqfliqfccziolgabsnmondcxpgfp');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (NULL,99429,'Maryland','vxquq');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99430,'i','l');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (195,99431,'m','me');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (19123,99432,'up','lb');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (8,99433,'it\'s','j');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (7,99434,'now','one');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99995,'rtcfyygbit','m');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99996,'sxnmrtcfyy','Maryland');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (NULL,99997,'usxnmrtcfy','North Carolina');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (210,99998,'e','k');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (10958,99999,'gz','Wisconsin');
            INSERT INTO `table100000_myisam_int_autoinc` VALUES (38,100000,'ihgzkeausx','di');

            --enable_query_log
            --enable_result_log

            SELECT COUNT FROM `table100000_myisam_int_autoinc` IGNORE KEY (col_varchar_64_key,col_varchar_10_key) WHERE ( ( `col_varchar_64_key` = 'i' ) OR `col_varchar_10_key` IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) ) OR ( `pk` BETWEEN 120 AND 79 + 255 OR `col_smallint_key` IN ( 4 , 179 , 1 ) ) AND ( ( `col_smallint_key` > 8 ));
            SELECT COUNT FROM `table100000_myisam_int_autoinc` WHERE ( ( `col_varchar_64_key` = 'i' ) OR `col_varchar_10_key` IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) ) OR ( `pk` BETWEEN 120 AND 79 + 255 OR `col_smallint_key` IN ( 4 , 179 , 1 ) ) AND ( ( `col_smallint_key` > 8 ));

            Show
            philipstoev Philip Stoev added a comment - Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union Shorter, if not prettier, test case: --disable_query_log --disable_result_log CREATE TABLE `table100000_myisam_int_autoinc` ( `col_smallint_key` smallint(6) DEFAULT NULL, `pk` int(11) NOT NULL AUTO_INCREMENT, `col_varchar_10_key` varchar(10) DEFAULT NULL, `col_varchar_64_key` varchar(64) DEFAULT NULL, PRIMARY KEY (`pk`), KEY `col_smallint_key` (`col_smallint_key`), KEY `col_varchar_10_key` (`col_varchar_10_key`), KEY `col_varchar_64_key` (`col_varchar_64_key`) ) ENGINE=MyISAM AUTO_INCREMENT=100001 DEFAULT CHARSET=latin1; INSERT INTO `table100000_myisam_int_autoinc` VALUES (30371,99001,'dl','e'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (3,99002,'Ohio','t'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (9,99003,'Delaware','xb'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99004,'Pennsylvan','i'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (179,99427,'fliq','because'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (16636,99428,'North Dako','quqfliqfccziolgabsnmondcxpgfp'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (NULL,99429,'Maryland','vxquq'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99430,'i','l'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (195,99431,'m','me'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (19123,99432,'up','lb'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (8,99433,'it\'s','j'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (7,99434,'now','one'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99995,'rtcfyygbit','m'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (0,99996,'sxnmrtcfyy','Maryland'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (NULL,99997,'usxnmrtcfy','North Carolina'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (210,99998,'e','k'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (10958,99999,'gz','Wisconsin'); INSERT INTO `table100000_myisam_int_autoinc` VALUES (38,100000,'ihgzkeausx','di'); --enable_query_log --enable_result_log SELECT COUNT FROM `table100000_myisam_int_autoinc` IGNORE KEY (col_varchar_64_key,col_varchar_10_key) WHERE ( ( `col_varchar_64_key` = 'i' ) OR `col_varchar_10_key` IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) ) OR ( `pk` BETWEEN 120 AND 79 + 255 OR `col_smallint_key` IN ( 4 , 179 , 1 ) ) AND ( ( `col_smallint_key` > 8 )); SELECT COUNT FROM `table100000_myisam_int_autoinc` WHERE ( ( `col_varchar_64_key` = 'i' ) OR `col_varchar_10_key` IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) ) OR ( `pk` BETWEEN 120 AND 79 + 255 OR `col_smallint_key` IN ( 4 , 179 , 1 ) ) AND ( ( `col_smallint_key` > 8 ));
            Hide
            philipstoev Philip Stoev added a comment -

            table with 1000 rows and just the 4 required columns
            LPexportBug637978_bug637978-2.dump

            Show
            philipstoev Philip Stoev added a comment - table with 1000 rows and just the 4 required columns LPexportBug637978_bug637978-2.dump
            Hide
            philipstoev Philip Stoev added a comment -

            Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union

            Show
            philipstoev Philip Stoev added a comment - Re: Wrong result with maria-5.1-wl24 and index_merge / sort_union
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 637978

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

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: