On Sep 30, 2010, at 9:13 AM, Henry Baragar wrote: > Two things: > • Getting the counter should be a 1+1 operation, not 1+n. If its not, > then this could be a place for improvement. > • I find the counters to be almost useless in the final code: they are > good in development to show that the relationships work properly. I suspect > that this is the case in most applications (although I have no supporting > data), which means that optimizing it should be a lower priority.
I think there's a different definition of 'N' in play here - Tiago (I suspect) was referring to the case where you're displaying N records as cards on a page, rather than a single record with N associated records. The latter is O(1), as it fires a SQL count, but the former has to fire N SQL counts... I've also found counter caches handy in joined scopes, where manually counting associated records would require serious SQL-fu. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
