"Jesse Erlbaum" <[EMAIL PROTECTED]> wrote: >Hi Peter -- > >> > The morale of the story: Flat files rock! ;-) >> >> If I'm using Apache::DBI so I have a persistent connection to MySQL, >> would it not be faster to simply use a table in MySQL? > > >Unlikely. Even with cached database connections you are probably not going >to beat the performance of going to a flat text file. Accessing files is >something the OS is optimized to do. The process of issuing a SQL query, >having it parsed and retrieving results is probably more time-consuming than >you think.
All depends on the file structure. A linear search through a thousand records can be slower than a binary search through a million (500 ave. compares vs. about 20 max [10 ave.] compares - hope the extra overhead for the binary search is worth the savings in comparisons). >One way to think about it is this: MySQL stores its data in files. There >are many layers of code between DBI and those files, each of which add >processing time. Going directly to files is far less code, and less code is >most often faster code. MySQL also stores indices. As soon as you start having to store data in files and maintain indices, you might as well start using a database. >The best way to be cure is to benchmark the difference yourself. Try out >the Benchmark module. Quantitative data trumps anecdotal data every time. Definitely. But before you do, make sure the proper indices are created on the MySQL side. Wrong database configurations can kill any performance gain. -- James Smith <[EMAIL PROTECTED]>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix