RSS Feed/News Inefficient query in XF\ReactionAbstractHandler::updateRecentCacheForUserChange

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,625
Points
823

Reputation:

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...
 
Status
Not open for further replies.
Top