MySQL Forums
Forum List  »  InnoDB

Best method for keeping visitor count in database
Posted by: navaneeth kn
Date: February 20, 2008 04:06AM

One of our project is a content management system something like wikipedia. So I need to calculate the visitors count getting for each article. Each article in this will have a unique id. So I am looking for a best method to keep the visitor count in database.

I have a master table where article details are kept. I tried adding a column named "PageView" which will be updated each time the page is requested. This worked well when website gets very less traffic. But shows incorrect results when it's running on heavy traffic. I guess it's a row level locking issue. Is there any other better approach which can be used to keep the accurate visitor count ?

The work around which is in my mind is, putting a lock to the row when I select "PageView" for updating. Update the count and release the lock. If this is right, will the other select requests to the same row wait until the lock get released ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Best method for keeping visitor count in database
2131
February 20, 2008 04:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.