[wp-trac] [WordPress Trac] #19901: Speeding up Dashboard and Comment moderation SQL load
WordPress Trac
wp-trac at lists.automattic.com
Thu Jan 26 22:14:17 UTC 2012
#19901: Speeding up Dashboard and Comment moderation SQL load
-------------------------+--------------------------
Reporter: FolioVision | Owner: markjaquith
Type: enhancement | Status: accepted
Priority: normal | Milestone: 3.4
Component: Performance | Version: 3.3.1
Severity: critical | Resolution:
Keywords: needs-patch |
-------------------------+--------------------------
Comment (by coffee2code):
Replying to [comment:2 markjaquith]:
> I validated these results. The large dataset was 4.7 million comments.
It's much, much faster to query the individual approval statuses. It seems
that statuses with more members take longer, so inferring the "1" result
by subtracting the other results from the total is a nice speedup.
Any performance difference in doing an `IN()` as opposed to separate
queries?
`SELECT COUNT( comment_ID ) FROM wp_comments WHERE comment_approved IN (
'trash', 'spam', '0', 'post-trash' );`
Could then throw a filter on the comment statuses prior to inclusion in
the `IN()` so non-public comments can be omitted. Which somewhat ties in
with...
Replying to [comment:3 ryan]:
> Plugins can set comment_status to anything. I think we'd need to
introduce comment status registration, like we do with post status.
+100
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19901#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list