Magento – Immense slow / hanging query when searching Magento 2

catalogsearchmagento2performancesearch

I am sorry that I can't supply more information. We have tried Mirasvit Ultimate Search but at one point it fills up and crashes, ruining the website layout. (I am in contact with Mirasvit and will give access to development environment. In the mean time, I need this to perform better and not cause the website to crash.)

We now use the standard search again but this also piles up somehow with the follow queries:

INSERT INTO `search_tmp_5a5de009b26075_57197513` 
SELECT `main_select`.`entity_id`,
       MAX(score) AS `relevance`
FROM (
    SELECT
        `search_index`.`entity_id`,
        (((0) + (0)) * 1 + SUM((
            CASE WHEN `data_index` LIKE ' vt keramieke vervangschijf voor rvs diffusor aqv7757 '
                 THEN 5
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% vt %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% keramieke %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% vervangschijf %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% voor %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% rvs %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% diffusor %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '% aqv7757 %'
                 THEN 3
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '%vt%'
                 THEN 2
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '%keramieke%'
                 THEN 2
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '%vervangschijf%'
                 THEN 2
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '%voor%'
                 THEN 2
                 ELSE 0
            END
            +
            CASE WHEN `data_index` LIKE '%rvs%'
                 THEN 2
                 ELSE 0
            END
            +
            CASE WHEN `data_inde[...]

And these queries keep piling up as long as customers search for them. So if a customer is impatient (which they are) they'll press enter numerous times.

Is there any way we can handle these queries more efficiently, or is there any advice regarding the searching situation on Magento 2? I did read a lot that the search is not very efficient.

If anyone has advice or any helpful URL's that can point me in the right direction, thanks in advance.

Best Answer

Use a real search engine instead of the MySQL one. ElastcSuite should run smoothly : https://github.com/Smile-SA/elasticsuite

Related Topic