Berkeley DB Reference Guide: Access Methods
Полезная информация

Berkeley DB Reference Guide: Access Methods

Logical record numbers

Both the Berkeley DB Btree and Recno access methods can be accessed using logical record numbers.

In all cases for the Recno access method, and in some cases with the Btree access method, a record number may be specified to reference a specific key/data pair. In the case of Btrees supporting duplicate data items, i.e., a single key may have more than one associated data item, the logical record refers to a key and all of its data items.

Record numbers are 32-bit unsigned types, which limits the number of logical records in a database to 4,294,967,296.

Logical record numbers are 1-based, not 0-based, i.e., the first record in the database is record number 1.

Record numbers in Btree databases are always mutable, i.e., as records are deleted or inserted, the logical record number for other records in the database can change. The Recno access method can be configured to run in either mutable or fixed mode: mutable, where logical record numbers change as records are deleted or inserted, and fixed, where record numbers never change regardless of the database operation. (See Logically renumbering records (DB_RENUMBER) for more information.

Configuring Btree databases to support record numbers can severely limit the throughput of applications with multiple concurrent threads writing the database.