proctk Posted September 7, 2007 Share Posted September 7, 2007 Hi I have been doing some searching for a tutorial on creating a simple tracking script to attach to each of my pages. The tutorials that I found are using a log.txt file instead of a mysql database. can anyone explain why not use a mysql database Quote Link to comment https://forums.phpfreaks.com/topic/68300-mysql-table-vs-log-file/ Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 i dont know why you dont want to use db. db is much faster than text file and i have something saying that flat file is no good for big storage ! Quote Link to comment https://forums.phpfreaks.com/topic/68300-mysql-table-vs-log-file/#findComment-343419 Share on other sites More sharing options...
dbo Posted September 7, 2007 Share Posted September 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68300-mysql-table-vs-log-file/#findComment-343436 Share on other sites More sharing options...
btherl Posted September 7, 2007 Share Posted September 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68300-mysql-table-vs-log-file/#findComment-343438 Share on other sites More sharing options...
ToonMariner Posted September 7, 2007 Share Posted September 7, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68300-mysql-table-vs-log-file/#findComment-343555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.