[MCOL-1150] Query performance on MariaDB 10.2 vs MySQL 5.7 Created: 2018-01-05  Updated: 2021-01-15

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Sukan Assignee: Andrew Hutchings (Inactive)
Resolution: Unresolved Votes: 0
Labels: optimizer
Environment:

CentOS Linux release 7.2.1511 (Core)



 Description   

Below is the query which runs in less than 1.5 min in MySQL 5.7,but on MariaDB it is running more than 5 minutes.

On checking the explain plan MySQL using an index on derived table but MariaDB doesn't.

Note : In MySQL we have 71L records and in MariaDB we have 72L. Both having same structure and index.

Explain on MySQL

UPDATE test.FUID SET AND_FTD=(select and_ftd from                     (SELECT MOBILE, MIN(CASE WHEN BRAND_NEW IN ('AND') THEN BILLDATE END ) and_ftd              FROM HISTORY              GROUP BY MOBILE              ) a              where FUID.MOBILE=a.MOBILE);
 
+----+--------------------+-------------------+------------+-------+---------------+--------------+---------+-------------------------------+---------+----------+-------------+
| id | select_type        | table             | partitions | type  | possible_keys | key          | key_len | ref                           | rows    | filtered | Extra       |
+----+--------------------+-------------------+------------+-------+---------------+--------------+---------+-------------------------------+---------+----------+-------------+
|  1 | UPDATE             | FUID       | NULL       | ALL   | NULL          | NULL         | NULL    | NULL                          | 1078188 |   100.00 | NULL        |
|  2 | DEPENDENT SUBQUERY | <derived3>        | NULL       | ref   | <auto_key0>   | <auto_key0>  | 23      | test.FUID.MOBILE|  715905 |   100.00 | Using where |*
|  3 | DERIVED            | HISTORY | NULL       | index | MOBILE  | MOBILE | 23      | NULL                          | 7159059 |   100.00 | NULL        |
+----+--------------------+-------------------+------------+-------+---------------+--------------+---------+-------------------------------+---------+----------+-------------+

On MariaDB

UPDATE test.FUID SET AND_FTD=(select and_ftd from                     (SELECT MOBILE, MIN(CASE WHEN BRAND_NEW IN ('AND') THEN BILLDATE END ) and_ftd              FROM HISTORY              GROUP BY MOBILE              ) a              where FUID.MOBILE=a.MOBILE);
 
+------+--------------------+-------------------+-------+---------------+--------------+---------+------+---------+-------------+
| id   | select_type        | table             | type  | possible_keys | key          | key_len | ref  | rows    | Extra       |
+------+--------------------+-------------------+-------+---------------+--------------+---------+------+---------+-------------+
|    1 | PRIMARY            | FUID       | ALL   | NULL          | NULL         | NULL    | NULL | 1120281 |             |
|    2 | DEPENDENT SUBQUERY | <derived3>        | ALL   | NULL          | NULL         | NULL    | NULL | 7028102 | Using where |*
|    3 | DERIVED            | HISTORY | index | NULL          | MOBILE | 23      | NULL | 7028102 |             |
+------+--------------------+-------------------+-------+---------------+--------------+---------+------+---------+-------------+



 Comments   
Comment by Alice Sherepa [ 2018-01-08 ]

Please attach your .cnf file(s) and provide the output of

SHOW CREATE TABLE HISTORY;
SHOW CREATE TABLE FUID;
SHOW INDEX FROM HISTORY;
SHOW INDEX FROM FUID;

Comment by Sukan [ 2018-01-08 ]

Hi Alice,

Shall provide the same, but another thing.

This is working fine as expected in normal Mariadb 10.2 but in columnstore its not taking the index for derived table. Something must be missing in columnstore, please get this resolved at the earliest.

Comment by Andrew Hutchings (Inactive) [ 2018-01-12 ]

Hi Sukan,

This has been moved over to the ColumnStore team so we can look into this. Possibly one of the ColumnStore optimizer tweaks is breaking this. Can you please provide the information that Alice requested so we can reproduce this?

Generated at Thu Feb 08 02:26:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.