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
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Hi,
Are you running both servers on the identical data?
Which MySQL version are you comparing with?
Did you run ANALYZE TABLE on both servers?
Could you please attach the output of SHOW VARIABLES, please?
I am not getting the same plans, but of course it heavily depends on the actual data. Would you be able to upload the data dump to our ftp (ftp.askmonty.org/private)?
If not, please paste the output of SHOW INDEX IN c and SHOW TABLE STATUS LIKE 'c'.
Thanks.