Skip to content
Lawsuit Help Desk

Lawsuit News Center

Cracking the Code: Unraveling the Unexpected Performance Pitfall in Magento 2.3's Search Term Cache

Cracking the Code: Unraveling the Unexpected Performance Pitfall in Magento 2.3’s Search Term Cache

Magento 2.3's search term cache feature, despite being meant to increase efficiency, has caused a major performance problem relating to a specific time-consuming query, which slows down website functionality. The issue lies with the query, SELECT DISTINCT COUNT(*) FROM search_query AS main_table WHERE (main_table.store_id = 1) AND (num_results > 0). The problem is worsened with bigger 'search_query' tables, increasing the execution time.

Two key elements, the DISTINCT operator and the num_results condition, offer improvement potential. The DISTINCT operator, intended to ensure uniqueness, is unnecessary as the 'search_query' table already incorporates a unique constraint. Its removal boosts query performance, though the overall system impact needs analysis. Removing the num_results condition also enhances performance, but its precise impact on search functionality is uncertain. Therefore, the Magento 2.3 Search Term Cache issue stems from an unoptimized query, an unnecessary DISTINCT operator and a confusing 'num_results' condition; addressing these can enhance system performance.

Full article here: https://ipllfirm.com/all-insights/news-and-articles/cracking-the-code-unraveling-the-unexpected-performance-pitfall-in-magento-2-3s-search-term-cache/