Jump to content

mysql table vs log file


proctk

Recommended Posts

Reporting on data stored in a database is much easier to write and quicker to retrieve the results... however depending on the type of log you can't necessarily write to the DB, ie when a database connection fails. I think errors should be logged to a flatfile when they relate to database connections... otherwise I think the benefits of a database are many.

Link to comment
Share on other sites

Log files are faster and easier to write to the end of, and to read in their entirety.  But databases are faster and easier to query, and to write anywhere except the end.

 

So it depends on what you want to do with the data.  If you intend to query it on various conditions, you should probably use mysql.  If you intend to just write to the end and read it as a text file, you should use a log file.

Link to comment
Share on other sites

Logs are the kind of thing that many neglect.  They are the kind of thing we only look at when something goes wrong.  To that end flat files are the order of the day (pretty much why flat files are used for this kind of thing). 

 

Lots of writes and very few reads - and as btherl correctly states faster to write to than db.  if you are logging with php then you could always break the files up a little by logging by date.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.