Upgrading from 8.x-1.28 to 8.x-1.29 using the MySQL backend causes a severe slowdown in performance due to the addition of a left outer join. It seems this was added in #2877319?
8.x-1.28:
SELECT "t"."item_id" AS "item_id", SUM(t.score) AS "score"
FROM
(SELECT "t"."item_id" AS "item_id", SUM(t.score) AS "score", CASE WHEN t.word LIKE :like_w1 THEN 1 ELSE 0 END AS "w1"
FROM
{search_api_db_atlas_text} "t"
WHERE ("t"."word" LIKE :db_condition_placeholder_1 ESCAPE '\\') AND ("t"."field_name" IN (:db_condition_placeholder_2, :db_condition_placeholder_3, :db_condition_placeholder_4, :db_condition_placeholder_5, :db_condition_placeholder_6, :db_condition_placeholder_7, :db_condition_placeholder_8, :db_condition_placeholder_9, :db_condition_placeholder_10, :db_condition_placeholder_11, :db_condition_placeholder_12, :db_condition_placeholder_13, :db_condition_placeholder_14, :db_condition_placeholder_15, :db_condition_placeholder_16, :db_condition_placeholder_17, :db_condition_placeholder_18, :db_condition_placeholder_19, :db_condition_placeholder_20, :db_condition_placeholder_21, :db_condition_placeholder_22, :db_condition_placeholder_23, :db_condition_placeholder_24, :db_condition_placeholder_25, :db_condition_placeholder_26))
GROUP BY "t"."item_id", "w1") "t"
LEFT OUTER JOIN {search_api_db_atlas_mist_platform__access_policy} "t_2" ON t.item_id = t_2.item_id
WHERE "t_2"."value" = :db_condition_placeholder_0
GROUP BY "t"."item_id"
8.x-1.29:
SELECT "t"."item_id" AS "item_id", SUM([t].[score]) AS "score"
FROM
(SELECT "t"."item_id" AS "item_id", SUM([t].[score]) AS "score", CASE WHEN [t].[word] LIKE :like_w1 THEN 1 ELSE 0 END AS "w1"
FROM
{search_api_db_atlas_text} "t"
WHERE ("t"."word" LIKE :db_condition_placeholder_1 ESCAPE '\\') AND ("t"."field_name" IN (:db_condition_placeholder_2, :db_condition_placeholder_3, :db_condition_placeholder_4, :db_condition_placeholder_5, :db_condition_placeholder_6, :db_condition_placeholder_7, :db_condition_placeholder_8, :db_condition_placeholder_9, :db_condition_placeholder_10, :db_condition_placeholder_11, :db_condition_placeholder_12, :db_condition_placeholder_13, :db_condition_placeholder_14, :db_condition_placeholder_15, :db_condition_placeholder_16, :db_condition_placeholder_17, :db_condition_placeholder_18, :db_condition_placeholder_19, :db_condition_placeholder_20, :db_condition_placeholder_21, :db_condition_placeholder_22, :db_condition_placeholder_23, :db_condition_placeholder_24, :db_condition_placeholder_25, :db_condition_placeholder_26))
GROUP BY "t"."item_id", "w1") "t"
LEFT OUTER JOIN {search_api_db_atlas} "t_2" ON t.item_id = t_2.item_id
LEFT OUTER JOIN {search_api_db_atlas_mist_platform__access_policy} "t_3" ON t.item_id = t_3.item_id
WHERE "t_3"."value" = :db_condition_placeholder_0
GROUP BY "t"."item_id"
Comments
Comment #2
TheTomatoFarmerReturns commented+1
Comment #3
lgomezc commented+2.
We had to downgrade to version 8.x-1.28 due to performance issues. Specifically, in one of our sites, the CPU consumption for MySQL was constantly over 100%. In another site, we encountered issues with the search_api_fulltext, which returned empty results despite having data.
Comment #4
drunken monkeyThanks a lot for reporting this problem, and already identifying the “culprit”. You’re correct, it very much seems like we were a bit sloppy when reviewing this issue’s patch, it indeed adds an unnecessary
JOINunder certain conditions.The attached patch should fix this, please test/review!
Comment #5
drunken monkeyComment #6
davidhk commentedI saw this same problem after upgrading to 8.x-1.29, with searches taking several minutes to complete.
After applying the patch the performance has returned to normal.
Comment #8
drunken monkeyThanks a lot for testing and reporting back! Good to hear this worked for you.
Merged. Thanks again, everyone!
Comment #9
bart vanhoutte commentedThanks for following up!