Closed
Bug 445344
Opened 16 years ago
Closed 16 years ago
Optimize commentslib query
Categories
(support.mozilla.org :: General, defect)
support.mozilla.org
General
Tracking
(Not tracked)
RESOLVED
FIXED
0.6.1
People
(Reporter: laura, Assigned: laura)
References
Details
(Whiteboard: sumo_triage)
Attachments
(2 files, 1 obsolete file)
118.70 KB,
image/png
|
Details | |
2.61 KB,
patch
|
nkoth
:
review+
|
Details | Diff | Splinter Review |
From: https://bugzilla.mozilla.org/show_bug.cgi?id=425135#c40 Rewrite this query in commentslib to use subselects select a.`threadId`,a.`object`,a.`objectType`,a.`parentId`, a.`userName`,a.`commentDate`,a.`hits`,a.`type`,a.`points`, a.`votes`,a.`average`,a.`title`,a.`data`,a.`hash`,a.`user_ip`, a.`summary`,a.`smiley`,a.`message_id`,a.`in_reply_to`,a.`comment_rating`, IFNULL(max(b.`commentDate`), a.`commentDate`) as `lastPost`, count(b.`threadId`) as `replies`, (a.`type` = 's') AS sortorder from `tiki_comments` a left join `tiki_comments` b on b.`parentId`=a.`threadId` where a.`object`='1' and a.`objectType` = 'forum' and a.`parentId` = 0 group by a.`threadId`,a.`object`,a.`objectType`,a.`parentId`,a.`userName`,a.`commentDate`,a.`hits`,a.`type`,a.`points`,a.`votes`,a.`average`,a.`title`,a.`data`,a.`hash`,a.`user_ip`,a.`summary`,a.`smiley`,a.`message_id`,a.`in_reply_to`,a.`comment_rating` order by sortorder DESC, `hits` asc, `threadId` LIMIT 180,20;
Assignee | ||
Comment 1•16 years ago
|
||
Here's the code with revised query - it's about 100x faster in my testing.
Attachment #331239 -
Flags: review?(nelson)
Comment 2•16 years ago
|
||
Comment on attachment 331239 [details] [diff] [review] Patch to rewrite the query When I try this patch on my server, the forum topics returned have a lot of duplicated entries per thread (topic). See attachment.
Attachment #331239 -
Flags: review?(nelson) → review-
Comment 3•16 years ago
|
||
Assignee | ||
Comment 4•16 years ago
|
||
I forgot to add a DISTINCT when I killed the group by.
Attachment #331239 -
Attachment is obsolete: true
Attachment #331317 -
Flags: review?(nelson)
Updated•16 years ago
|
Attachment #331317 -
Flags: review?(nelson) → review+
Assignee | ||
Comment 5•16 years ago
|
||
In trunk in r17404, prod branch in r17407.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Whiteboard: sumo_triage
You need to log in
before you can comment on or make changes to this bug.
Description
•