jaymc Posted October 24, 2007 Share Posted October 24, 2007 500 of these a minute if (file_exists("file.txt")) {DO STUFF} Or 500 of these a minute SELECT ìd` FROM chatconnections WHERE user = 'joebloggs' LIMIT 0,1 The table chatconnections will only ever have about 10 records in by the way See i want to create a live chat and Im wondering whats the best way to conncurently check if someone wants to chat. Whether its better to have a flat file created or a database entry. Either of which will need to be checked for every minute Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/ Share on other sites More sharing options...
neoform Posted October 24, 2007 Share Posted October 24, 2007 If you're thinking of storing the chat cache in a file, don't. Use mysql. You're far less likely to run into issues stemming from file reading/writing. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-376942 Share on other sites More sharing options...
fenway Posted October 24, 2007 Share Posted October 24, 2007 Using flat files is just asking for trouble -- there's a reason they invented databases. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-377026 Share on other sites More sharing options...
jaymc Posted October 26, 2007 Author Share Posted October 26, 2007 No.. it was just to store a chat request Rather then query the database table every minute to see if a chat request row exists for the member I was thinking of just having a folder, when someone wants to chat, a text file is created named after the members username username.txt If that file exists, we know someone wants to chat, so then start the chat and delete that file If it doesnt exist, obviously no one is waitint to chat.. Yeh? Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-378679 Share on other sites More sharing options...
toplay Posted October 26, 2007 Share Posted October 26, 2007 You've been given two opinions already, however, in case you need a third as the tie breaker, then I say use DB tables too. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-378748 Share on other sites More sharing options...
fenway Posted October 26, 2007 Share Posted October 26, 2007 No.. it was just to store a chat request Rather then query the database table every minute to see if a chat request row exists for the member I was thinking of just having a folder, when someone wants to chat, a text file is created named after the members username username.txt If that file exists, we know someone wants to chat, so then start the chat and delete that file If it doesnt exist, obviously no one is waitint to chat.. Yeh? Files were not meant for this... stick with the DB. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-378785 Share on other sites More sharing options...
jaymc Posted October 27, 2007 Author Share Posted October 27, 2007 Are you sure? MySQL currently gets hammered, the less load I can take off that service the better Unless useing flat files causes more over head in regards to CPU, Disk I/O etc This is what Im saying, if both could be benchmarked.. which is going to be better for system wide performance Mysql is great for handling and manipulating large sets of data, but is it better in regards to minimal data.. when alterntives can be used Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379439 Share on other sites More sharing options...
GingerRobot Posted October 27, 2007 Share Posted October 27, 2007 Surely a fourth person giving the same opinion will be enough? Databases were designed for storing data, for accessing data, for sorting data etc. Files were not. Use the right tool for the job! Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379487 Share on other sites More sharing options...
jaymc Posted October 28, 2007 Author Share Posted October 28, 2007 But what if alls my process is doing is simple checing if the file exists if (file_exists("jamie.txt")) { OK LETS DO IT } As apposed to SELECT `id` FROM chatseshions WHERE user = 'jamie' LIMIT 1 if num_rows == 1 {DO STUFF} Surely in this case file_exists would be better/faster? Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379917 Share on other sites More sharing options...
toplay Posted October 28, 2007 Share Posted October 28, 2007 I think we've beaten this topic to death. If you don't want to take the opinion of others, then don't. Just do what you want to. Try both ways, see what appeals to you or what works better. Please don't keep asking the same thing over and over. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-379976 Share on other sites More sharing options...
fenway Posted October 29, 2007 Share Posted October 29, 2007 I think we've beaten this topic to death. If you don't want to take the opinion of others, then don't. Just do what you want to. Try both ways, see what appeals to you or what works better. Please don't keep asking the same thing over and over. Agreed... topic locked. Link to comment https://forums.phpfreaks.com/topic/74585-whats-faster/#findComment-380375 Share on other sites More sharing options...
Recommended Posts