[typo] handling amount of comments

Patrick Lenz patricklenz at gmail.com
Wed Jul 6 16:21:34 EDT 2005

On 7/6/05, Robby Russell <robby at planetargon.com> wrote:

> I wanted to follow up on this a bit more. I realized that we could
> easily add another field to the articles table called 'comment_count' so
> that we could utilize the counter cache. For some reason, when Curt logs
> into his admin area, it times out because the number of comments is in
> the several thousand. Do you think that this would help things?

There's a couple of things we have to tune performance-wise in the
not-too-distant future. For one, typo makes no use of eager loading in
the admin area yet (as far as I remember).

Regarding the counter cache, there's a bug in that logic presently
which is getting triggered if you populate the association upside
down. The counter is only updated via @article.comments << Comment.new
and not via @comment.article = Article.find() -- unless we can ensure
that no single spot in our code populates associations the wrong way
we can't potentially trust the counter cache.

Other than that, Curt's logs might indicate a few other problematic
queries I'd love to know about.


Patrick Lenz (scoop)

http://poocs.net/              # Personal Weblog
http://limited-overload.de/    # Web application development
http://freshmeat.net/          # Free software archive
http://topmedia.de/            # IT Storage Solutions

More information about the Typo-list mailing list