0

I am creating a record system for my site which will track users and how they interact with my site's pages. This system will record button clicks, page view times, and the method used to navigate away from a page (among other things.) I an considering one of two options:

  1. create a log file and append a string to it for each action.
  2. create a database table and save entries based on user interaction.

Although I am sure that both methods could easily fill my needs, which would be better in the long run. Other considerations:

  1. General page viewing will never cause this data to be read (only added to it.)
  2. Old Data should be archived, but still accessible.
  3. Data will be viewed and searched via web app
Hoytman
  • 1,722
  • 2
  • 17
  • 29

2 Answers2

1

As with most performance questions, the answer is 'It depends.'

I would expect it depends on the file system, media type, and operating system of your server.

I don't believe I've ever experienced performance differences INSERTing data into a large, or a small MySQL database. The performance differences manifest when you retrieve that data. The database will almost always outperform queries to files, especially when you want complex or statistical data.

If you are only concerned with the speed of inserting/appending data, and expect a large amount of traffic, build a mock environment and benchmark each approach. If you want to have any amount of speed retrieving that data in a structured way, go with the database.

Jerbot
  • 1,168
  • 7
  • 18
  • it's not about the size of the database, it's about how many insertions he will have to do when his site becomes popular. And there is another challenge, SQL (neither his file system database) are not very suited to process unstructured data and retrieve any useful information from it. – SQL.injection Jul 16 '13 at 08:02
0

If you want performance you should inspect the server log, instead of trying to build your log system...

SQL.injection
  • 2,607
  • 5
  • 20
  • 37