Berkeley DB Reference Guide: Access Methods
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

### Berkeley DB Reference Guide: Access Methods |

# Retrieving Btree records by number

The Btree access method optionally supports retrieval by logical record number. To configure a Btree to support record numbers, call the DB->set_flags function with the DB_RECNUM flag.

Configuring a Btree for record numbers should not be done lightly. While often useful, it requires that storing items into the database be single-threaded, which can severely impact application throughput. Generally it should be avoided in trees with a need for high write concurrency.

To determine a key's record number, use the DB_GET_RECNO flag to the DBcursor->c_get function.

To retrieve by record number, use the DB_SET_RECNO flag to the DB->get and DBcursor->c_get functions.

Copyright Sleepycat Software