Skip to content

Slow Search Queries - Possibly related to virtual categories #2097

@harrigo

Description

@harrigo

I have been using this module for a few years now and have found it relatively quick however over time have noticed a bit of a slow down. I have been playing with this on lesser hardware recently and found queries to be quite slow... here is a section of my profiler:


magento | 1.741605 | 1.741605 | 1 | 28,880,656 | 48,234,496
-- | -- | -- | -- | -- | --
...
·  ·  ·  ·  ·  ·  ·  ·  TEMPLATE:/var/www/buzzdevb/public_html/var/view_preprocessed/pub/static/vendor/magento/module-catalog-search/view/frontend/templates/result.phtml | 1.354794 | 1.354794 | 1 | 5,564,800 | 27,262,976
·  ·  ·  ·  ·  ·  ·  ·  ·  EAV: Magento\Eav\Model\Config::getAttribute | 0.001753 | 0.000008 | 212 | 9,776 | 0
·  ·  ·  ·  ·  ·  ·  ·  ·  ·  EAV: Magento\Eav\Model\Config::getEntityType | 0.000604 | 0.000003 | 212 | 11,000 | 0
·  ·  ·  ·  ·  ·  ·  ·  ·  EVENT:catalog_block_product_list_collection | 0.000271 | 0.000271 | 1 | 85,608 | 0
·  ·  ·  ·  ·  ·  ·  ·  ·  ·  OBSERVER:review | 0.000255 | 0.000255 | 1 | 83,800 | 0
·  ·  ·  ·  ·  ·  ·  ·  ·  EAV:load_collection | 1.241051 | 1.241051 | 1 | 2,616,152 | 27,262,976
·  ·  ·  ·  ·  ·  ·  ·  ·  ·  ES:Execute Search Query | 1.107998 | 0.276999 | 4 | 1,628,528 | 10,485,760
·  ·  ·  ·  ·  ·  ·  ·  ·  ·  ES:Virtual Rule getSearchQueriesByChildren | 0.076594 | 0.038297 | 2 | 20,891,272 | 14,680,064

So the whole page is taking around 1.74 seconds which is pretty slow for my site with uncached product and category pages taking like 0,5-0,7s TTFB. The main issue I am having is certain search queries. My store has about 20,000 products and feel that should be relatively small but searching plates can take a while as have a few 1000 of them and I feel this shouldn't be the case.

The main slow down seems to be within the ES:Execute search query (taking 1.1s of the 1.7) and i thought that should be pretty lightning quick. I have looked at other "slow" examples on here where the issue was not the ES query time as that was clocking in at 0.001889 which would be magic if that was the case for me!

I have been finding reducing my usage of virtual categories has been helping this and the more that are created seems to be worsening but I do like the feature and have come to reply on it in some cases.

I am working on moving to having these "virtual categories" actually indexed based on rules so they are just normal categories refreshed every night due to this but just wanted to check it this was normal and if there was anything else that could be suggested that may be going wrong or if this is completely abnormal?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions