Skip to content
Lawsuit Help Desk

Lawsuit News Center

Unmasking Magento's Search Query Dilemma: How the 'Distinct' Operator Burdens Databases and the Potential Fixes You Should Know About

Unmasking Magento’s Search Query Dilemma: How the ‘Distinct’ Operator Burdens Databases and the Potential Fixes You Should Know About

The 2.3 upgrade of Magento has caused severe CPU overloads due to a specific search term cache query. This primarily involves the 'DISTINCT' operator in the search query which, considering the unique 'query_text' and 'store_id' constraints, is unneeded and slows process speed. The issue worsens with increasing search_query table size, leading to execution times between 0.7 and 23 seconds. Efforts to solve the problem, including disabling search suggestions, haven't resolved the high CPU load. The problem also affects versions 2.4.1-p1, 2.4.2-p2, 2.4.4-p1, and 2.4.5-p4. Potential solutions include removing the 'DISTINCT' operator from the Magento\Search\Model\ResourceModel\Query\Collection and inserting search terms asynchronously into the search_query table. Close monitoring and systematic implementation of these changes can enhance Magento's performance and efficiency.

Full article here: https://ipllfirm.com/all-insights/news-and-articles/unmasking-magentos-search-query-dilemma-how-the-distinct-operator-burdens-databases-and-the-potential-fixes-you-should-know-about/