Btree versus Hash

Copying The Bthash Library

The following features are compared between a btree database and a hashing database.

Feature Btree Hash
Sorted data Yes No
Direct access Yes Yes
Partial key Yes No
Sequential access Yes No
Delete Yes Yes
Space recovery Yes Yes
Requires reorganization Infrequently Infrequently
Adapted to rapid growth Yes No
Adapted to high turnover Yes Yes
Very large databases More levels, longer blocks Yes
Initial Space Root record Entire database
Space overhead 33 percent Space/time tradeoff
Good for temporary database Yes Less suited
Easy to configure Yes Slightly harder
Signed numeric keys Sort problem No problem
Binary data Yes Yes
Good for Unicode Yes Yes
Accepts encrypted data Yes Yes