SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Mars
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Files OR MySQL database for counters?

    Hi all,

    I intend to write my own script to display some detailed stats about the number of my website visitors.

    the number of visitors is 5000+ per day

    what I want to display is just the number of visitors in (each hour in last 24 hr,each day of last week,each day of last month, overall) Also, I want to list the top and latest 10 referers. that's all

    Is it better to use MySQL database or plain text files to store data? and why?

    Thanks in advance

  2. #2
    Romans 12:2 codyrockx's Avatar
    Join Date
    Jul 2003
    Location
    Newberg, Oregon
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would use mysql, cause then u could specifically select and edit each entry, and format it, although thats just my preference
    Codyrobert.com - Designer and Developer

  3. #3
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MySQL is much better for this hands down. Especially if you don't just want to retrieve information, but also sort it etc., MySQL is much faster. With a text-file you'd end up writing one heck of a function to retrieve everything, sort it yada yada .

  4. #4
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    MySQL is usually better for this purpose. Take into account that it is usually faster to write to a file than to a MySQL server, but then again MySQL will allow you to do joins and use indexes, which you wouldn't be able to do with a file, and which would cause MySQL to be significantly faster upon retrieving the information in many ways.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2003
    Location
    Mars
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone for the advice.

    but won't that increase the size of the database vastly since there will be an insert to the database in each visit?

    I cannot empty the database each month becase I will need the data for stats but rather the database can be emptied at the begining of every new year

    If I decided to use databases, will it affect the system resources?

  6. #6
    SitePoint Member
    Join Date
    Apr 2004
    Location
    UK
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit: I misread the post above.

    Storing in mySQL should be no more of a problem then files. For detailed stats in files you'd still have to store alot of information, lots of files which add alot of overhead -
    Using mySQL should be less overhead then files I think

    You can redesign it to have a row for each day for example, and just increment the relevant rows if your that concerned about space.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •