03-27-2003, 02:11 PM
I am working on a chat room in php. The key issue naturally is minimizing the data passed on each refresh (which can be aided by client side handling). But apart form that, is there likely to be any performance edge in using a database or a flat file? The assumption here is that I would keep only the last 50 to 100 messages in the flat file, and that I am doing a destructive write to the flat file each time - i.e., it gets compeltely rewritten each time there is input.
03-27-2003, 04:24 PM
Databases will definetly be faster in most cases.
Databases will definetly be faster in most cases. :confused:
Why? Because there's more overhead?I completely don't get this.
Also don't quite get the flatfile idea (to me, a flatfile is a table). Think a regular textfile or a simple XML file would do the trick just fine.
If you'd use MySQL4, you probably could use the query-buffer function, but that looks like complete overkill to me.
Originally posted by gorilla1
i.e., it gets compeltely rewritten each time there is input.
can't u append to the file instead?
i see no reason why a flat file couldn't match the speed of a database in this case.
04-04-2003, 09:46 PM
with a flatfile, how would you get around the problem that multiple lines may need to be written at the same time? Sure, lock the file, but then the others will be lost...
I would prefer the database route.
::] krycek [::
04-04-2003, 10:00 PM
Before I got a database, I saw no reason for needing one, now I have a database, I wouldnt not use it!
Just refresh part of the page aswell. Have you considered a flash room. I dont know what they are like on bandwitdth, but they run pretty smooth.
04-05-2003, 04:36 AM
Just for the record, flatfile databases are based off of text files