Slow processing of attributes with Table source_model #38934
Labels
Issue: ready for confirmation
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
Projects
Summary
When working with product collections I found out that getting attribute values is very slow because of using method
\Magento\Eav\Model\Entity\Attribute\Source\Table::getSpecificOptions
. This method is not optimized to work with product collections because it loads data from Database every time attribute value is requested.Taking in mind that
\Magento\Eav\Model\Entity\Attribute\Source\Table
is a default source model for any attribute which has nosource_model
defined ineav_attribute
table it brings a siriouse performance degradation. For example, when working with attribute of textfrontend_input
type it usesgetSpecificOptions()
method which returns empty response every time.To get attribute value there 2 possible loading stacks.
Stack 1. Performance degradation is detected for only attributes of select, multiselect
frontend_input
typeStack 2. Performance degradation is detected for all attribute regardless of
frontend_input
typeExamples
See Summary section with explanations
Proposed solution
Use
\Magento\Eav\Model\Entity\Attribute\Source\Table::getAllOptions
call ingetSpecificOptions
method, so it will minimize the number of SQL queries to 1 per attribute per product collection because option values ingetAllOptions
method are cachedRelease note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: