Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9212849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:37:05+00:00 2026-06-18T01:37:05+00:00

May I know what’s the best practice for storing page views in database? Is

  • 0

May I know what’s the best practice for storing page views in database?

Is it costly to update the pageview value every time the page is loaded?

And is there any possible errors/threats while updating the pageview and in the same time, someone else is modifying the same row’s data?

For e.g.

Table – Item
ID
Name
Description
PageView

I understand it might not be a very big issue, it can apply to some other data that updates very often, would like to know what’s the best approach of doing it.
The possible scenario that came into my mind was, if there’s a lot of pages is running in the simultaneously. Will there be any performance issue?

Pardon my English, and many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:37:07+00:00Added an answer on June 18, 2026 at 1:37 am

    The best approach is to write a new line into the table for every view, rather than to keep a rolling tally which could lead to locking problems on a large system. For additional performance, you can add rows using INSERT DELAYED syntax. This will allow the DB handle to return immediately and your script won’t wait for the insert to complete. Documentation here:-

    http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html

    It might also be worth looking at the Archive storage engine which is aimed specifically at this type of logging. You can only INSERT and SELECT data but performance is aimed at rapid writing.

    http://dev.mysql.com/doc/refman/5.1/en/archive-storage-engine.html

    To view pageview information you simply query the number of rows for any given page. A major advantage of this approach is that by logging a timestamp with every page view, you can analyse data by time of day, days of week etc. and see what shape your traffic is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You may know here is a page comparing the XML parsers for Iphone, http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
As you may know, the wall rect will not update since its a copy
As you may know not long time ago facebook added several new features. One
As you may know from my previous posts, I'm learning Python. And this time
As you may know, properties are usually written in files in key=value format but
You may know this recommendation from Microsoft about the use of exceptions in .NET:
You may know the scriptaculous SlideUp effect . Well, It slides up a div
So as you may know, arrays in C# implement IList<T> , among other interfaces.
As you may know, Silverlight 3 doesn't support IMultiValueConverter and... I badly need it.
As some of you may know, use of the LIMIT keyword in MySQL does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.