dbTalk Databases Forums  

Ridiculous database size

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Ridiculous database size in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Smalltalk80
 
Posts: n/a

Default Ridiculous database size - 06-21-2007 , 08:13 PM






I'm building a hash-based databased where key and data are both 8-byte
integers. There is roughly 50M entries, so the actual data size is
about 800M, but the produced db file is 2.1G. Why does it use so much
space for a hash table which is supposed to be a compact data
structure?

Here's my configuration:

db.set_cachesize(10, 0 * 1024 * 1024, 1); //If I set it to 2G,
then it becomes terribly slow after 20M entries. I don't understand
why.
u_int32_t pageSize = 4 * 1024; // block size on my machine
db.set_pagesize(pageSize);
db.set_h_ffactor((pageSize - 32) / (keySize + 8 + 8)); //
according to recommendation
db.set_h_nelem(50000000);
db.open(NULL, "test.db", NULL, DB_HASH, DB_CREATE |
DB_TRUNCATE, 0);

Thanks!


Reply With Quote
  #2  
Old   
Smalltalk80
 
Posts: n/a

Default Re: Ridiculous database size - 06-21-2007 , 11:53 PM






btw, the keys are first 8 bytes of MD5 digest of a word


Reply With Quote
  #3  
Old   
zengli8916@126.com
 
Posts: n/a

Default Re: Ridiculous database size - 06-29-2007 , 11:12 PM



On 6 22 , 9 13 , Smalltalk80 <timtan... (AT) gmail (DOT) com> wrote:
Quote:
I'm building a hash-based databased where key and data are both 8-byte
integers. There is roughly 50M entries, so the actual data size is
about 800M, but the produced db file is 2.1G. Why does it use so much
space for a hash table which is supposed to be a compact data
structure?

Here's my configuration:

db.set_cachesize(10, 0 * 1024 * 1024, 1); //If I set it to 2G,
then it becomes terribly slow after 20M entries. I don't understand
why.
u_int32_t pageSize = 4 * 1024; // block size on my machine
db.set_pagesize(pageSize);
db.set_h_ffactor((pageSize - 32) / (keySize + 8 + 8)); //
according to recommendation
db.set_h_nelem(50000000);
db.open(NULL, "test.db", NULL, DB_HASH, DB_CREATE |
DB_TRUNCATE, 0);

Thanks!
The smaller the databseEntry,the lager space will be used in bdb.
for example:
if you set the key as 8-byte integer,the data as 20 8-byte
integers,then 2.5M entries will use much less space than before.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.