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
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue is caused by |
Description |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: *************************** 1. row *************************** id: 1 select_type: SIMPLE table: main_table partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 659999 filtered: 0.50 Extra: Using where 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: *************************** 1. row *************************** id: 1 select_type: SIMPLE table: main_table partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 659999 filtered: 0.50 Extra: Using where 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
Description |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: *************************** 1. row *************************** id: 1 select_type: SIMPLE table: main_table partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 659999 filtered: 0.50 Extra: Using where 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: id: 1 select_type: SIMPLE table: main_table partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 659999 filtered: 0.50 Extra: Using where 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
Description |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: id: 1 select_type: SIMPLE table: main_table partitions: NULL type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 659999 filtered: 0.50 Extra: Using where 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
Attachment | Capture0.PNG [ 49307 ] |
Attachment | Capture1.PNG [ 49308 ] |
Description |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: *************************** 1. row *************************** id: 1 select_type: PRIMARY table: main_table type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 671326 Extra: Using where *************************** 2. row *************************** id: 1 select_type: PRIMARY table: <derived3> type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 31001 Extra: Using where; FirstMatch(main_table) *************************** 3. row *************************** id: 3 select_type: DERIVED table: NULL type: NULL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: NULL Extra: No tables used However, there is no way to disable subqueries in 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. |
This issue affects Magento2 (leading eCommerce CRM): https://magento.com/
Most likely related to 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*: - see screenshot 1 !Capture0.PNG|thumbnail! 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*: - see screenshot 2 !Capture1.PNG|thumbnail! However, there is no way to disable subqueries in 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. |
Assignee | Varun Gupta [ varun ] |
Summary |
|
IN predicate to IN subquery conversion causes performance regression |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Varun Gupta [ varun ] | Sergei Petrunia [ psergey ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Sergei Petrunia [ psergey ] | Varun Gupta [ varun ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.3.21 [ 24014 ] | |
Fix Version/s | 10.4.11 [ 24013 ] | |
Fix Version/s | 10.5.1 [ 24029 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link |
This issue relates to |
Link |
This issue relates to |
Fix Version/s | 10.3.22 [ 24018 ] | |
Fix Version/s | 10.3.21 [ 24014 ] |
Fix Version/s | 10.4.12 [ 24019 ] | |
Fix Version/s | 10.4.11 [ 24013 ] |
Link |
This issue relates to |
Comment | [ A comment with security level 'Developers' was removed. ] |
Workflow | MariaDB v3 [ 100606 ] | MariaDB v4 [ 156902 ] |
Zendesk Related Tickets | 184082 |
in_predicate_conversion_threshold now works on release builds too, this was fixed in https://jira.mariadb.org/browse/MDEV-16871. Should be available with 10.3.18 onwards.
You can set in_predicate_conversion_threshold to 0 to disable this optimization, this would be
a temporary workaround.