Forum Moderators: coopster

Message Too Old, No Replies

Update file views. How do you do that?

Updating file views

         

jojy

12:06 am on Apr 28, 2008 (gmt 0)

10+ Year Member



Hello all,
Recently i have been checking mysql server log and found update statements for file views is taking good enough amount of time. Currently i am simply updating a file view counter when ever user visit the file page. Does it make sense to update view counter if user views more than 1 time file page? in a day or so? I think no.. this is my personal experience mysql updates come at cost.. especially when you are using indexes..

I open this thread to discuss the possible solutions.. here are few solutions that i have in mind..

- Set cookie for 24 hrs and store file ids which user visited and check them on each file page (limited due to cookie size)
- Store all values in session instead of cookie
- Create table in database and store all values in db and check table whenever user visit file page. (resource hungry solution)

What would you do if you fall in the same situation?

Thanks,
Jojy

coopster

6:29 pm on May 3, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Does it make sense to update view counter if user views more than 1 time file page? in a day or so? I think no.

I think you have answered that question for yourself, and rightly so. You are the one that determines the statistics you choose to track, store and display. As far as the solution? The cookie value seems as though it should work effectively but I guess it all depends on how many files you are dealing with amongst other variables. You may find that your update process is not so bad after all!

jojy

10:03 pm on May 3, 2008 (gmt 0)

10+ Year Member



Thanks coopster for your reply. My site is keep growing and i have about 95000 files. Average page view per user is about 200+. I am also thinking about cookies but cookies are not always enabled and I am afraid session can be expensive for the server. This mixed situation tells me to detect user's browser and check which one is going to work.