![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
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! |
![]() |
| Thread Tools | |
| Display Modes | |
| |