Details

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

      Description

      Table structure:

      CREATE TABLE `c` (
        `cid` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `qid` int(10) unsigned NOT NULL DEFAULT '0',
        `aid` int(10) NOT NULL DEFAULT '0',
        `URN` int(10) NOT NULL DEFAULT '0',
        `in_id` int(10) unsigned NOT NULL DEFAULT '0',
        `out_id` int(10) unsigned NOT NULL DEFAULT '0',
        `DDIstr` varchar(24) NOT NULL,
        `CLIstr` varchar(24) NOT NULL,
        `datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `microtime` varchar(30) NOT NULL DEFAULT '0 0',
        `duration` float NOT NULL DEFAULT '0',
        `wtime` float NOT NULL DEFAULT '0',
        `wrtime` float NOT NULL DEFAULT '0',
        `rtime` float NOT NULL DEFAULT '0',
        `result` varchar(15) DEFAULT NULL,
        `t_cdr` int(10) DEFAULT NULL,
        `c_outcome` int(10) DEFAULT NULL,
        `d_code` varchar(10) DEFAULT NULL,
        `r_cost` float DEFAULT NULL,
        `c_cost` float DEFAULT NULL,
        `dataset` mediumint(8) NOT NULL DEFAULT '0',
        PRIMARY KEY (`cid`),
        KEY `aid` (`aid`),
        KEY `datetime` (`datetime`),
        KEY `result` (`result`),
        KEY `in_id` (`in_id`),
        KEY `out_id` (`out_id`),
        KEY `c_outcome` (`c_outcome`),
        KEY `qid` (`qid`),
        KEY `d_code` (`d_code`),
        KEY `agentid_2` (`aid`,`datetime`),
        KEY `get_max_cid` (`aid`,`cid`),
        KEY `max_cid_2` (`aid`,`result`,`cid`),
        KEY `t_cdr` (`t_cdr`),
        KEY `c_uid` (`URN`,`qid`),
        KEY `DDISTR_2` (`DDISTR`,`datetime`),
        KEY `CLISTR` (`CLISTR`),
        KEY `qid_2` (`qid`,`datetime`)
      ) ENGINE=InnoDB 
      

      Query:

      EXPLAIN
      SELECT
         c.`cid` AS `cid`
      FROM c
      WHERE
         c.result IN ('Answered','TPT') AND
         c.`datetime` BETWEEN '2014-05-01 00:00:00' AND '2014-05-29 23:59:59'
         AND c.qid = 42685
      ORDER BY cid LIMIT 300;
      
                                      • You may need to change datetime range above according to your data generated date. *****************

      MariaDB plan:

      1       SIMPLE  c       index   qid_2   PRIMARY 4       NULL    1488    Using where
      

      MySQL plan:

      1       SIMPLE  c       range   qid   PRIMARY 12       NULL    1488    Using where
      

      Ie. MySQL is much more quicker than MariaDB in this query.

      BTW, does the query optimizer have some sort of heuristic and can learn?

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            jwang james wang added a comment - - edited

            deleted in-correct comments - 10.0.12 does not fix my issue yet.

            Show
            jwang james wang added a comment - - edited deleted in-correct comments - 10.0.12 does not fix my issue yet.
            Hide
            jwang james wang added a comment -

            I have still not managed to replicated this issue yet either.

            It only happens when the index file becomes huge.

            So far, I tried upto 30 millions records in the table but failed to replicate the issue. The live databases has 800 million records

            Show
            jwang james wang added a comment - I have still not managed to replicated this issue yet either. It only happens when the index file becomes huge. So far, I tried upto 30 millions records in the table but failed to replicate the issue. The live databases has 800 million records
            Hide
            jwang james wang added a comment - - edited

            Hi Sergei,

            I have just updated the table structure.

            Is it possible for you for generate some pseudo data (please use c/c++ - quickest way in looping about 3 times quicker than java and 20 times quicker than php) and fill the table with hundred millions of records so as to replicate this issue please?

            I can not send you the table as it contain company real commercial data. Also, the table is a few GB and I have no means to transfer the file to you.

            Thanks a lot in advance
            James

            Show
            jwang james wang added a comment - - edited Hi Sergei, I have just updated the table structure. Is it possible for you for generate some pseudo data (please use c/c++ - quickest way in looping about 3 times quicker than java and 20 times quicker than php) and fill the table with hundred millions of records so as to replicate this issue please? I can not send you the table as it contain company real commercial data. Also, the table is a few GB and I have no means to transfer the file to you. Thanks a lot in advance James
            Hide
            jwang james wang added a comment - - edited

            Hi Sergei,

            We downloaded the 10.0.12 from yum.mariadb.org last Friday. Our issue seams gone. Great.

            Shall keep you informed.

            Thanks

            Show
            jwang james wang added a comment - - edited Hi Sergei, We downloaded the 10.0.12 from yum.mariadb.org last Friday. Our issue seams gone. Great. Shall keep you informed. Thanks
            Hide
            jwang james wang added a comment -

            Please close this ticket

            Show
            jwang james wang added a comment - Please close this ticket

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                jwang james wang
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: