Closed
Description
In Magento/CatalogSearch/Model/Resource/Fulltext.php, function resetSearchResults() there are some queries that set the whole column "is_processed" in the table "catalogsearch_query" to 0, e.g.:
$adapter->update($this->getTable('catalogsearch_query'),
array('is_processed' => 0));
This query is very slow because it possibly needs to update lots of rows every time resetSearchResults() is called. On our server (mage181, multi-store setup, no SSD) with ~40.000 rows in the table, the query took 0.5 seconds and was called regularly during product updates etc.
Fix:
-
Only update rows that are not already 0:
$adapter->update($this->getTable('catalogsearch/search_query'), array('is_processed' => 0), array('is_processed != 0'));
-
Add an index to the "is_processed" column in the "catalogsearch_query" table.
This will speed up the query considerably. AFAIK this issue affects all Magento versions, including 1.8.1.0.