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

Berkeley DB Reference Guide: Access Methods

Selecting a byte order

The database files created by Berkeley DB can be created in either little or big-endian formats.

The byte order used for the underlying database can be specified as part of the db_open call to open the database, specifically by setting the db_lorder element of the DB_INFO structure. If no order is selected, the native format of the machine on which the database is created will be used.

Berkeley DB databases are architecture independent, and any format database can be used on a machine with a different native format. In this case, as each page that is read into or written from the cache must be converted to/from the host format, it is possible that databases with non-native formats will incur a performance penalty for the run-time conversion.

It is important to note that the Berkeley DB access methods do no data conversion for application specified data, i.e., key/data pairs written on a little-endian format architecture will be returned to the application exactly as they were written, on a big-endian format architecture.