![]() |
Advance PHP prog. I need an advice.
Will it be faster to dump data into a file than in a Database ?
Thanks |
I'd think a DB would be faster since it supports multiple connections where as a file you have to deal with I/O resource constraints.
|
flat file would be faster, even though your still using multi connections your still using a wrapper to get to the database. still using a wrapper to use the file... i sitll think flat file will be faster
|
i believe its faster to write to but not read from.
|
I'd say flat file would be faster ... but I never saw benchmark ... anybody have a URL ?
|
file is faster to write/read from.. just don't go searching through it ;-)
|
HAHAHAHA Don't worry I'm not such a dumb ass :)
|
It's not hard to do your own benchmark, just loop through 1000s of inserts to a flat file and then database (probably open and close connection between each write). It's not exactly accurate, but will give you a rough idea.
|
Since everyone is saying the file - what happens if it's a high transaction load and you have to maintain locks on the file to ensure data integrity; wouldn't you hit a open / write / close limit as opposed to a database that can handle multiple at the same time ?
Seriously, I'd like to know as well. |
as long as you dont search
files but for example password username matching is also searching one more thing moving in files s always hard pointers etc db rulez |
DB access is always faster than a flatfile. Especially if you use the querycache function in mysql 4+
|
well he asked if it would be faster to dump data to a file or a db.. DUMp keyword :) if your reading it over and over.. db is the way to go.. just depends on what he's trying to do..
|
I just thougt - How can the DB be faster ?
Database will ultimately result into a write command to a flat file + all the operations to connect and interprate the command. So all the writting operation + some other... So it's quite sure files are faster ... the question now is will writting to files result in a file lock situation resulting into lag time ? A good way to avoid this would be to create a file everytime ... but I'm not sure this is the way to go ... Cause my system won't work in real time and I'll have to use a cron table to update my database everyday ... |
I was only thinking of this in terms of transaction load: Access to a file can only happen with one connection (write) at a time, but a DB can handle multiple connections (writes) at the same time as it's threaded. It's Saturday morning though, so I could be retarded and am thinking of this entirely wrong.
|
All times are GMT -7. The time now is 04:17 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123