B-tree is the balanced tree access method that D3 supports throughout the system and in every process that touches the database.

A B-tree is essentially a system-maintained ordered-list based on any attribute or combination of attributes from items in a file. It allows quick retrieval of items based on this secondary key.

With minor modifications, current D3 applications can make use of B-trees. Any D3 process that modifies an item automatically maintains the tree implicitly. This includes update, FlashBASIC, edit, copy, t-load, and restore.

AQL retrieves keys from a B-tree when an associated attribute-defining item is used in a by clause.

For example, in the statement:

sort entity by last.name

last.name points to an attribute that is also referenced by an i (index) processing code in the attribute defining item. If more than one by clause is used in the same request, AQL ignores the tree and scans the entire file. A with clause with no by clause also uses the tree.

A more flexible approach to incorporating B-trees to data retrieval is to use the Update processor or the FlashBASIC intrinsic functions like key and root.