M
MDW
I'm trying to create a hit counter for my Web page. The
fast and dirty option is to have the Web page read in the
value of the current count, add one to it, then update the
database and display the updated result on the page.
The other option we're playing with is, for each page
visit, insert the date and time of the visit into the
database. Thus, we'd have one record in the DB for each
visit (we'd periodically flush the DB, of course, but we'd
probably build this records over a period of one to three
months, so we'd accumulate a decent number of records).
Thus, to find the hit count, we'd grab the COUNT() of that
field.
We're kind of interested in the date/time option because
it would allow us to compile reports about when the
traffic is highest, etc.
But, once the DB grows to 100,000 + rows, we're worried
that the amount of time it would take to fetch the value
from a COUNT() statement would be overly long.
fast and dirty option is to have the Web page read in the
value of the current count, add one to it, then update the
database and display the updated result on the page.
The other option we're playing with is, for each page
visit, insert the date and time of the visit into the
database. Thus, we'd have one record in the DB for each
visit (we'd periodically flush the DB, of course, but we'd
probably build this records over a period of one to three
months, so we'd accumulate a decent number of records).
Thus, to find the hit count, we'd grab the COUNT() of that
field.
We're kind of interested in the date/time option because
it would allow us to compile reports about when the
traffic is highest, etc.
But, once the DB grows to 100,000 + rows, we're worried
that the amount of time it would take to fetch the value
from a COUNT() statement would be overly long.