I am developing a website which will have 200.000 pages. There is also a browse section, which shows most popular, highest rated etc. documents. However this section will become almost static couple of weeks later, after launch. So I also would like to implement a filtering system which will show today's, this week's, this month's most popular items, just like youtube.

Just like this:

<http://www.youtube.com/videos?c=2>

How should I implement this function? Do I need another table, which will have a new entry for every document each day?

docid, date, view\_count, rating

So I will get today's row for filtering by using a day, or calculate a week (7 rows) for filtering by using week? It seems not efficient. Do you have any suggestions?

I am using LAMP stack by the way.

Thanks,