in reply to What is a fast way to get keys of a Berkeley DB into an array?

As the NEXTKEY implementation in BerkeleyDB.xs also uses c_get, it looks like there is no way to retrieve keys only (without retrieving values).  NEXTKEY is the function called under the hood by BerkeleyDB's tied-hash interface when you call keys %hash.

Replies are listed 'Best First'.
Re^2: What is a fast way to get keys of a Berkeley DB into an array?
by mab (Acolyte) on Jun 09, 2010 at 19:37 UTC
    It looks like the Berkeley DB C API does support getting multiple keys at once using the DB_MULTIPLE_KEY flag:

    http://pybsddb.sourceforge.net/api_c/dbc_get.html

    It's not apparent to me though that this functionality is accessible through the Berkeley DB Perl module.

      As I understand DB_MULTIPLE_KEY would still retrieve complete entries, i.e. keys plus values, so any performance improvement (if the functionality was available, which I think it isn't) would likely only be marginal.