How Do You Handle Statistics?

Hi,

I’m working on a project and now I want to implement statistics.

Simplified I want this:

A user access a profile page, this action is stored into a table.

id|user_id|profile_id|datetime.

This table can grow very large and query it gonne slow things down I think. So I thought that it would be enough to parse these records and count up the visits per day.

id|user_id|profile_id|visits|date

This table will become big, but only one record per day, per profile, that’s not really shocking. So queries will go faster.

Also I can empty the first table form time to time.

Is this a good approach? What is your strategy with statistics? Is there anything Yii can do for me to make things easier? I could not find a lot about statistics.

Or should I not worry about tables growing up to > 1 million records?

No one use statistics or logs on his site? ::)

Hi,

You can use either a Yii system cache or you can store the statistic results in a table and refresh it after of certenly time

http://www.yiiframework.com/extension/dgsphinxsearch/

or

http://www.yiiframework.com/extension/yii-elastica/

Thank you both for your comments. I will look into this.

I understand that it’s not a very interesting topic, statistics are not that complicated most of the time. :unsure:

It is important for any comblex query in database :)