perl - Can I use multiple keys in Berkeley DB? -
i want use in berkeley db following perl logic (for many millions records):
$hash{key1}{key2}{key3}{count1}++; $hash{key1}{key2}{key3}{count2}++; ... (key1) { (key2) { (key3) { print $hash{key1}{key2}{key3}{count1}."\t".$hash{key1}{key2}{key2}{count2}; } } }
any example multiple keys? may of couse use "pseudo-multiple" key ( key1_key2_key3 ); there other way?
berkeley-db doesn't support multiple keys that. each record can have 1 key.
you can concatenate keys form single key, stated.
you can use mldbm give appearance of nested keys. works storing serialized hash under key1
, inefficient if have lot of keys nested under top-level key.
or, can give on bdb , go real sql database. dbd::sqlite easy install , includes sqlite database engine along driver.
i'd go either concatenating keys or real database, depending on you're trying do.
Comments
Post a Comment