Closed Bug 525493 Opened 15 years ago Closed 12 years ago

Review count script should be more efficient

Categories

(addons.mozilla.org Graveyard :: Maintenance Scripts, enhancement, P5)

x86
macOS
enhancement

Tracking

(Not tracked)

RESOLVED WORKSFORME
4.x (triaged)

People

(Reporter: davedash, Unassigned)

Details

(Whiteboard: [workqueue])

PHP Notice:  MySQL Error 0: 
Query was: [
           UPDATE addons AS a
           INNER JOIN (
               SELECT
                   versions.addon_id as addon_id,
                   COUNT(*) as count
               FROM reviews
               INNER JOIN versions ON reviews.version_id = versions.id
               WHERE reviews.reply_to IS NULL
                   AND reviews.rating > 0
               GROUP BY versions.addon_id
           ) AS c ON (a.id = c.addon_id)
           SET a.totalreviews = c.count
       ] in /data/amo/www/addons.mozilla.org-remora/bin/database.class.php on line 130


This query is expensive.  It has to go through each addon, get an aggregate and do a join on multiple tables.

For AMO v4, we can just increment the review count, on save of a review - or load this into gearman and do it per addon as needed.
Whiteboard: amov4 workqueue
Severity: normal → enhancement
Priority: -- → P5
Whiteboard: amov4 workqueue → [workqueue]
Target Milestone: --- → 4.x (triaged)
Target Milestone: 4.x (triaged) → 6.0.5
Target Milestone: 6.0.5 → 4.x (triaged)
Assignee: dd → nobody
Well AMO is still running so I am going to assume this isn't a real issue.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.