Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3.18, 10.4.8
-
Debian Linux Buster and Stretch
Description
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to MDEV-12176.
Magento2 is using Entity-Attribute-Value model (EAV), also known as object-attribute-value.
with 315 tables. Here is the diagram:
https://anna.voelkl.at/magento-ce-2-1-3-database-diagram/
As a result, there are multiple "IN " statements in queries. Here is one of the problematic queries:
SELECT `main_table`.* FROM `url_rewrite` AS `main_table` WHERE (`redirect_type` = '0') AND (`entity_type` = 'product') AND (`entity_id` IN('448', '503', '532', '547 ........... <------ if the number of products here exceeds 1000, then "optimizer" creates subqueries.
In MariaDB 10.1 and 10.2 and also MySQL 8 it's a SIMPLE execution plan that takes 6 seconds:
95210 rows in set (5.58 sec)
On MariaDB 10.3 and 10.4 on the same server with the same settings (including optimizer_switch) it's now 35 mins:
However, there is no way to disable subqueries in MDEV-12176 (@@in_predicate_conversion_threshold doesn't work on production releases)
The database is about 7GB and contains sensitive data. That's why I didn't attach it to this issue. It is available on request.
Attachments
Issue Links
- is caused by
-
MDEV-12176 Transform [NOT] IN predicate with long list of values INTO [NOT] IN subquery.
- Closed
- relates to
-
MDEV-21265 IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
- Closed
-
MDEV-20871 Queries with entity_id IN ('1', '2', ..... , '70000') run much slower in MariaDB 10.3.18 than on MariaDB 10.1
- Closed
-
MDEV-23704 Optimizer does not use semijoin optimization for some WHERE (pk1, pk2, pk3) IN ((1,2,3), ...) queries
- Closed