Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl: the Markov chain saw
 
PerlMonks  

Re: mySQL or Flat Files, Which is faster

by Trimbach (Curate)
on Feb 08, 2004 at 14:16 UTC ( #327457=note: print w/ replies, xml ) Need Help??


in reply to mySQL or Flat Files, Which is faster

Yes there's some overhead for DBI connections, but unless your program can access particular files by name (that is, your program is given a specific file to access without having to do any searching) then MySQL is going to definitely be faster. For example, if you have one file per user, and each file is named after the user, and the only thing your program will ever do for User X is access File X, then flat files will be quicker.

On the other hand, if there are multiple files per user, or you want to slice and dice the data in different ways (i.e. "Give me all the files for User X, created between January and March, that have to do with 'Foo'") then you should just go ahead and do the relational database tango and use MySQL. Although it's true that MySQL builds its internal data structures on top of whatever file system it's in, it gets HUGE speed advantages over flatfiles from the proper use of indexes, allowing you to get to just the data you need without having to search through every file in the database.

Think about what you're doing (and what you're likely to want to do with your program in the future) and make the appropriate decision. :-)

Gary Blackburn
Trained Killer


Comment on Re: mySQL or Flat Files, Which is faster

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://327457]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (15)
As of 2014-04-18 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (469 votes), past polls