0

I have below queries on my pages for each attribute, It become more than 11000 request in my magento2 pages. any body can help me?

SELECT eav_attribute.*
FROM eav_attribute
WHERE (eav_attribute.attribute_id='70')
SELECT eav_entity_type.additional_attribute_table
FROM eav_entity_type
WHERE (entity_type_id = :entity_type_id)
SELECT catalog_eav_attribute.*
FROM catalog_eav_attribute
WHERE (attribute_id = :attribute_id)
0

You could perform SQL joins to reduce multiple requests to SQL server. In your case you could write query as

SELECT eav_attribute.*, eav_entity_type.additional_attribute_table, catalog_eav_attribute.*
FROM eav_attribute LEFT JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_attribute.entity_type_id
LEFT JOIN catalog_eav_attribute ON catalog_eav_attribute.attribute_id = eav_attribute.attribute_id
WHERE eav_attribute.attribute_id ='70'

If you wanna get information of multiple attributes in single request you could write as

SELECT eav_attribute.*, eav_entity_type.additional_attribute_table, catalog_eav_attribute.*
FROM eav_attribute LEFT JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_attribute.entity_type_id
LEFT JOIN catalog_eav_attribute ON catalog_eav_attribute.attribute_id = eav_attribute.attribute_id
WHERE eav_attribute.attribute_id IN ('70', '71')

Hope it finds you helpful.

  • Thanks, in which file should i do it? I dont know where is it. Know that in eav module it hapends but don't know what shoul i do – MGPM Aug 11 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.