Solved Inefficient query in XF\ReactionAbstractHandler::updateRecentCacheForUserChange

This topic has been solved
K

Kirby

Guest
PHP:

Code:
\XF::db()->query("
    UPDATE (
        SELECT content_id FROM xf_reaction_content
        WHERE content_type = ?
        AND reaction_user_id = ?
    ) AS temp
    INNER JOIN {$table} AS reaction_table ON (reaction_table.`$primaryKey` = temp.content_id)
    SET reaction_table.`{$recentField}` = REPLACE(reaction_table.`{$recentField}`, ?, ?)
", [$this->contentType, $newUserId, $oldFind, $newReplace]);

This query tries to update all records for $newUserId, even those whre...

Read more

Continue reading...