Magento EAV query performance issue on the product view page #39554
Labels
Reported on 2.4.x
Indicates original Magento version for the Issue report.
Triage: Dev.Experience
Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Summary
On the product view, we have SQL to load the product attribute information from EAV tables which looks like below one
SELECT
u
.* FROM ( (SELECTt
.value
,t
.attribute_id
,t
.store_id
FROM ..........UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROM ........UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROM .................. AND (attribute_id IN (87, 62, 88, 63, 77, 78, 1387, 1388, 966)) AND (store_id
IN (6, 0))) ) ASu
ORDER BYstore_id
ASCThis is a top query in the system which contribute to the database CPU usage. It likely happens on a system with MANY different products so caching was not very effective.
Examples
SELECT
u
.* FROM ( (SELECTt
.value
,t
.attribute_id
,t
.store_id
FROMcatalog_product_entity_int
ASt
WHERE (entity_id = '156494') AND (attribute_id IN (1440, 80, 474, 1124, 807, 1391, 1172, 1227, 1119, 1434, 541, 502, 759, 1441, 1453, 540, 503, 537, 471, 1370, 1274, 1443, 1445, 1437, 1540, 1353, 1416, 74, 1438, 1497, 1350, 470, 585, 1364, 81, 473, 500, 1351, 1361, 815, 1409, 1428, 1405, 1406, 472, 749, 841, 85, 538, 1111, 1334, 1366, 1371, 1408, 767, 1489, 1543, 1394, 1545, 607, 1238, 1239, 1345, 1352, 1369, 1419, 1420, 1421, 871, 1342, 1382, 1384, 1365, 1476, 1499, 1500, 1498, 1495, 1491, 1503, 1526, 1504, 1508, 1528, 1544, 475, 573, 773, 775, 777, 779, 781, 785, 787, 789, 963, 964, 965, 968)) AND (store_id
IN (6, 0)))UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROMcatalog_product_entity_text
ASt
WHERE (entity_id = '156494') AND (attribute_id IN (58, 57, 68, 1572, 1444, 89, 1507, 1478, 1479, 1480, 1510, 1529, 1547, 971)) AND (store_id
IN (6, 0)))UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROMcatalog_product_entity_varchar
ASt
WHERE (entity_id = '156494') AND (attribute_id IN (70, 82, 90, 469, 1451, 1375, 1191, 1414, 1482, 56, 71, 67, 92, 1452, 1377, 1125, 1314, 1232, 1392, 1415, 72, 1430, 86, 1558, 1483, 1412, 1442, 1432, 69, 1429, 1127, 499, 1413, 1511, 79, 1514, 1212, 907, 1512, 1513, 1570, 1410, 83, 95, 96, 97, 1114, 1418, 1407, 514, 1108, 1222, 1354, 1393, 1359, 1379, 1390, 1277, 1477, 1515, 1525, 903, 1575, 476, 477, 783)) AND (store_id
IN (6, 0)))UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROMcatalog_product_entity_decimal
ASt
WHERE (entity_id = '156494') AND (attribute_id IN (61, 1433, 1435, 1126, 64, 1436, 75, 60, 909, 1439, 84, 65, 765, 769, 771, 1297, 1355)) AND (store_id
IN (6, 0)))UNION ALL(SELECTt
.value
,t
.attribute_id
,t
.store_id
FROMcatalog_product_entity_datetime
ASt
WHERE (entity_id = '156494') AND (attribute_id IN (87, 62, 88, 63, 77, 78, 1387, 1388, 966)) AND (store_id
IN (6, 0))) ) ASu
ORDER BYstore_id
ASCProposed solution
There were some discussion short here
https://yegorshytikov.medium.com/adobemagento-commerce-eav-performance-issue-fix-included-8b1a45e98904
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: