Files vs. Databases

    Date: 06/20/06 (PHP Community)    Keywords: php, database, java

    I have a question about which is more expensive: writing to a file, or saving to a database. We're talking about an average of 450 characters (when the array is serialized). The usage is always read frequent, but it varies between write frequent and write infrequent.

    The PHP script is an interface for a couple people, connected via AJAX. The script gets called oncy every 5 seconds (by each person via JavaScript) to make sure they're all on the same page. Right now I'm using the filesystem - I know that, should by some miracle I get more servers in the future, using files won't be an option. But, right now I'm on one and probably staying on only one.

    I want to know where to save this information. What is worse - running file_get_contents() and unserialize() every 5 seconds, or calling a database every 5 seconds? I've heard bad things about both, and I'm wondering what your opinions are.

    Source: http://community.livejournal.com/php/462018.html

« for loop question || someone help me please?? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home