|We don't bite newbies here... much|
size on disk of tied hashesby danderson (Beadle)
|on Aug 11, 2004 at 00:50 UTC||Need Help??|
danderson has asked for the wisdom of the Perl Monks concerning the following question:
Most honourable Monks,
I am at an impasse. I have data (well, will have, right now I'm working with dynamically created test data) which, if stored as plaintext, should take up about 40G - in other words, I can fit it in files on an only moderately expensive hard drive. However, I need sublinear-time access to the data. It's very simple, all key-value pairs where the keys are between 10 bytes and 100 bytes and the values are between 10 bytes and 300 bytes.
qq(Perfect!); I thought. qq(There's no way that a tied hash will double the size, I can fit this all on one hard drive!);
Yeah, no. Test data with SDBM_File-tied hashes shows 12.3m of data taking 467m of space. Needless to say, this will not work for me, as I can't afford 40 hard drives.
So, to the point, my question is: are there implementations of efficient persistant storage mechanisms that still have ~log(x) access time? With the number of hard drive cache misses I'll be having, and considering the size of the data, linear access is not an option.
And yes, I've gone through the first ten pages of Google's results for tie and hash, and supersearched, and read the Cookbook, etc.
If there isn't one implemented, I'll write one myself, but I hate to reinvent the wheel only to discover that my octagon is inferior to an already-made, pre-polished circle.
Thanks (in advance) for your time!