in reply to DB_File vs flat file in terms of speed

MZSanford++

Not only will DB_File keep your little duckling hashes in the proverbial row, but it's a much easier method of retrieval than a flat file database.

There is a small file size difference. I recently moved away from flat files for storing my simple programs' information. My data files are now around 40KB for files that were once 2-4KB flat files. Regranted, on most PCs today, this kind of difference is insignificant, but on a hosted webserver, it may become a nuisance (if you have a lot of databases).

Best of luck in your database endeavors.

John J Reiser
newrisedesigns.com

  • Comment on Re: (nrd) DB_File vs flat file in terms of speed

Replies are listed 'Best First'.
Re: Re: (nrd) DB_File vs flat file in terms of speed
by kiat (Vicar) on Oct 25, 2002 at 16:05 UTC
    Thanks, John! The increase in file size (from 2 to 40 KB) is atrocious :) So assuming server space is premium, one will have to weigh the speed and efficiency gained against the increase in file file...?

      I don't believe the database size is directly related to the flat file size. If you tie a %hash, put nothing in it, then untie, the db file will be around 32KB (at least for me: Win2K/ASPerl). I assume this 32KB is the data structure with no data. It grows slowly (not exponentially, thank God) as you put more data into the tied hash.

      Size isn't a pressing issue, just a thought. I have 125MB of data on my webserver, but have only used about 10 for the past year.

      Next on your plate should be learning SQL and the DBI module, so you can interface with mySQL, Postgres, Oracle, and Access. Dominus has a good article on SQL and DBI here

      Glad to be of service,

      John J Reiser
      newrisedesigns.com

Re^2: (nrd) DB_File vs flat file in terms of speed
by Anonymous Monk on Dec 19, 2007 at 23:18 UTC
    Hi John My apps have 100k entries In flat its looks like this(matched users): 3052002:1054002 3052002:2050002 1054004:2050002 1054004:1054002 and its size is 4M but when i use SDBM like this: $all_match{'3052002:1054002'}=1; $all_match{'3052002:2050002'}=1; $all_match{'1054004:2050002'}=1; $all_match{'1054004:1054002'}=1; The file size gets to 1G any idea how can i get it smaller? Thanks Eyal
Re^2: (nrd) DB_File vs flat file in terms of speed
by Anonymous Monk on Dec 19, 2007 at 23:21 UTC
    why its all in one line? thus is the format for one line: 3052002:1054002