crashmaster Posted January 2, 2008 Share Posted January 2, 2008 Hi there, I have user system. Every time, whn user something do - I store date and time of action in file. I have a question. What is faster? To save in file or in db ? (every users per 1 session could make about 400-1000 clicks) Quote Link to comment https://forums.phpfreaks.com/topic/84034-speed-mysql-vs-file/ Share on other sites More sharing options...
teng84 Posted January 2, 2008 Share Posted January 2, 2008 this has been ask tons of times.. and the response i read is that if you need small storage use flat file otherwise DB DB works fast than file Quote Link to comment https://forums.phpfreaks.com/topic/84034-speed-mysql-vs-file/#findComment-427704 Share on other sites More sharing options...
Barand Posted January 2, 2008 Share Posted January 2, 2008 Presumably you store it for a reason and not just for fun. When it comes to analysing the content a db will win hands down. Quote Link to comment https://forums.phpfreaks.com/topic/84034-speed-mysql-vs-file/#findComment-427714 Share on other sites More sharing options...
duclet Posted January 2, 2008 Share Posted January 2, 2008 Unless you need to use the data right away, I suggest using both. Store them to a file and then at set intervals, add them to the database as a batch. With that you said in the first post, adding each click each and every time it is done is going to kill your database (heck, that is why sites that receive a lot of traffic cache your database output). Always do batch inserts if you can so that you don't kill your database. Quote Link to comment https://forums.phpfreaks.com/topic/84034-speed-mysql-vs-file/#findComment-427724 Share on other sites More sharing options...
crashmaster Posted January 2, 2008 Author Share Posted January 2, 2008 I store this actions for ONLINE user checks... Quote Link to comment https://forums.phpfreaks.com/topic/84034-speed-mysql-vs-file/#findComment-428375 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.