# Collecting Model Statistics

**URL:** <https://www.ruby-forum.com/t/collecting-model-statistics/106359>\
**Category:** Rails\
**Created:** [June 9, 2007, 12:08am UTC](https://www.ruby-forum.com/t/collecting-model-statistics/106359 "2007-06-09T00:08:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.j.thomas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@michael.j.thomas](https://www.ruby-forum.com/u/michael.j.thomas)\
**Post date:** [June 9, 2007, 12:08am UTC](https://www.ruby-forum.com/t/collecting-model-statistics/106359/1 "2007-06-09T00:08:33Z")

</div>

I have a model hierarchy that looks like:

User has many days, a day has many items.

I’m trying to collect cheap (processing) statistics about the items,  
specifically on the count of duplicates.

Ultimately I want to know if an item is such that it is included in  
many days, and further more to know the rank of top items in the  
system.

Currently I have a Count function that determines how many times an  
Item is found, but it’s expensive to execute when it’s run for  
thousands of items. Any ideas?
