[wp-hackers] Caching of numbers of comments?
ryan at boren.nu
Thu Dec 22 20:40:17 GMT 2005
On Thu, 2005-12-22 at 19:16 +0100, Sebastian Herp wrote:
> Peter Westwood wrote:
> >On Thu, December 22, 2005 1:25 pm, Sebastian Herp wrote:
> >>Hello list,
> >>wordpress 2.0 RC3 seems to cache a lot of things. Does it cache the
> >>number of comments returned by the "comments_number"-function? Because
> >>that number seems to be displayed wrong in several postings. Why exactly
> >>does this need caching or is this bug not related to the cache?
> >>The function currently returns "5 comments" while I definetly see 6 ...
> >Comment Count is stored in the db against each post to save on queries for
> >the front page. (New in 2.0)
> >I suspect you are running a comment processing plugin that die()'s inside
> >the hook like Spam Karma 2 does (The fix for which is here -
> Aha! That's exactly what is causing the problem. Thank you! Introducing
> redundancy at this point is however the baddest idea I've ever seen. Why
> would someone "copy" a simple number just to save one simple query that
> uses less than one tenth of a millisecond to execute? A query, btw, that
> could have been easily "joined" to the main-query which gets the posts
> ... redundancy in a database scheme is a very very very (I can't say it
> often enough) bad thing ...
COUNT() is very slow with InnoDB.
More information about the wp-hackers