From: Robert Klemme Date: 2008-04-02T00:53:11+09:00 Subject: Re: should I use a database or a flat file? ------=_Part_8391_21331910.1207065188501 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2008/4/1, James Dinkel : > > > But ultimately it depends on what you want to do with the data. > > yeah, it's kinda hard to describe without just posting my entire script, > which I doubt people will want to read. I found that plain English works best for anything that is longer than a few lines. :-) > The data will be accessed by one ruby script, running on one computer. > The data will be read in, then the file closed and done for a couple > hours. So no concurrent access, no relations, no keeping the connection > open for extended periods of time, which is why I thought a database > would probably be overkill and just add overhead. Yep. > But I didn't know if maybe reading a file into memory would take more > effort than reading entries from a database. Also, I was a little off > on the numbers, I meant to say that there are hundreds of names per > category, You *did* say that. > so total names could be over a thousand. That size will > likely never ever change beyond +/- 100 at the most. 1000 is a really meek number. I did a quick test and also for illustration (attached). 17:51:23 /c/Temp $ ./yam.rb 0.010 create 0.261 write 0.025 load 17:52:20 /c/Temp Times in seconds > Thanks for the info. I'm really a newb at this, so any thoughts on > storing data using any of these methods is helpful. You're welcome. Kind regards robert -- use.inject do |as, often| as.you_can - without end ------=_Part_8391_21331910.1207065188501 Content-Type: application/x-ruby; name=yam.rb Content-Transfer-Encoding: base64 X-Attachment-Id: f_feinfcf9 Content-Disposition: attachment; filename=yam.rb IyEvYmluL2VudiBydWJ5CgpyZXF1aXJlICdzZXQnCnJlcXVpcmUgJ3lhbWwnCgpjbGFzcyBDYXRO YW1lcwogIGRlZiBzZWxmLnJlYWQoZmlsZV9uYW1lKQogICAgRmlsZS5vcGVuKGZpbGVfbmFtZSkg e3xpb3wgWUFNTC5sb2FkKGlvKX0KICBlbmQKICAKICBkZWYgc2F2ZShmaWxlX25hbWUpCiAgICBG aWxlLm9wZW4oZmlsZV9uYW1lLCAidyIpIHt8aW98IFlBTUwuZHVtcChzZWxmLCBpbyl9CiAgZW5k CiAgCiAgZGVmIGluaXRpYWxpemUKICAgIEBjYXQgPSB7fQogIGVuZAogIAogIGRlZiBhZGQoY2F0 LCBuYW1lKQogICAgKEBjYXRbY2F0XSB8fD0gU2V0Lm5ldykgPDwgbmFtZQogIGVuZAplbmQKCnQg PSBUaW1lLm5vdwoKZCA9IENhdE5hbWVzLm5ldwoKMTAwMC50aW1lcyBkbyB8aXwKICBkLmFkZCgi Y2F0I3tpLzEwMH0iLCAibmFtZSN7aSAlIDEwMH0iKQplbmQKCnR0ID0gVGltZS5ub3cKcHJpbnRm ICIlNi4zZiAlc1xuIiwgdHQtdCwgImNyZWF0ZSIKdCA9IHR0CgpkLnNhdmUgInRlc3QueWFtbCIK CnR0ID0gVGltZS5ub3cKcHJpbnRmICIlNi4zZiAlc1xuIiwgdHQtdCwgIndyaXRlIgp0ID0gdHQK CmQyID0gQ2F0TmFtZXMucmVhZCAidGVzdC55YW1sIgoKdHQgPSBUaW1lLm5vdwpwcmludGYgIiU2 LjNmICVzXG4iLCB0dC10LCAibG9hZCIKdCA9IHR0Cg== ------=_Part_8391_21331910.1207065188501--