June 4, 2020
Developers can index anything with FairCom DB database indexes
Flexibility includes creation, indexing and storing of binary values and structures in their database
Note: c-treeACE became FairCom DB in 2020.
FairCom DB is often called the developers database. And for good reason: It provides a level of control that few, if any, other databases provide. One area in which extreme control is prevalent is indexing.
How much indexing control do developers have? Developers can index anything with the FairCom DB multimodel database. This includes indexing arrays of bytes, binary structures, fields in records, SQL columns, XML, JSON, binary serialization protocols, images, etc. This is possible because each key in an index is an array of bytes, and there are no restrictions placed on the byte values comprising a key.

The result is that since anything can be represented by bytes, anything can be indexed. Because FairCom’s database engine compares keys using binary comparisons, its indexes can compare any type of data. And since binary comparisons are the fastest comparisons a computer can perform, FairCom DB provides the fastest possible record look ups, sorts and ordered traversals.
Developers have a lot of flexibility with indexes due to the Continuum of Control that FairCom provides. The Continuum ranges from automatically indexing SQL columns to giving a developer complete control over every byte being indexed.
FairCom DB includes the following index capabilities:
- FairCom’s SQL and NAV API automatically index one or more columns in a table.
- These indexes provide the full range of SQL indexing options.
- SQL and NAV indexes are easy to create.
- The database engine processes these indexes automatically at high speed.
- The APIs are designed to index SQL columns – not nested data structures.
- FairCom’s ISAM API treats a record in a file as an array of bytes. (Please note a record can be fixed or variable length, and because it is an array of bytes, it may contain anything: data structures, fixed fields, variable-length fields, images, JSON, XML, etc.)
- The ISAM API makes it easy to index one or more ranges of bytes in the record.
- Each range of bytes is called a segment, with an index key containing one or more segments.
- Each segment can be collated in ascending or descending order, and it can also reverse the bytes for fast tail searches.
- ISAM indexes are easy to create.
- The database engine processes them automatically at very high speed.
- They are designed for fixed and variable-length fields – not nested data structures.
- An index segment can be fixed or variable.
- A fixed segment has a fixed offset from the beginning of the record, and it has a fixed length.
- Fixed segments must come first in the record before variable segments.
- A variable segment is defined by a relative field number.
- The offset of the first variable field is the first byte following the fixed portion of the record.
- It continues until it reaches a delimiter byte, which defaults to 0, but can be any byte value.
- Each subsequent variable-length field starts at the first byte following the end of the previous variable field up to the delimiter byte.
- Segments do not have to align with fields in the data.
- They can index partial parts of fields, such as indexing selected bytes from different fields, indexing different segments from the same field, or both.
- Each segment can be collated individually in ascending or descending order.
- Each segment can be transformed automatically into the proper value for collation, such as a signed or unsigned integer, upper case string, padded string, Binary Coded Decimal (BCD), a custom collating sequence, automatically generated sequence number, etc.
- A fixed segment has a fixed offset from the beginning of the record, and it has a fixed length.
- The ISAM API makes it easy to index one or more ranges of bytes in the record.
- FairCom gives developers the ability to write callback functions to manage index values. These functions are called when the value in a record changes, a file is opened, and a file is closed.
- The callback functions are stored in a dynamic object library (Windows Dynamic Link Library (DLL), Linux Shared Object (.so), or MacOS Dynamic Library (.dylib)).
- They can be called synchronously or asynchronously.
- When a record is updated, the callback function receives the binary contents of the record so it can extract and transform bytes into a key to be stored in the index.
- The callback function can index parts of any binary structure no matter how complex.
- Any binary structure can be stored in a record while traditional values are stored in indexes, such as integers, doubles, strings, etc.
- For the same data record, developers can optionally store multiple keys in an index, which makes it easy to index multi-value items, such as arrays.
- For example, a record can contain JSON, XML, BSON, Protocol Buffers, Flat Buffers, Message Pack and so forth. The row-level callback function can extract anything to create the key value you want to index.
- This makes it easy to index any data and query it using SQL and the NAV API.
In addition to this wide range of development capabilities, FairCom also provides a Low-level API for C and C++ developers to directly control all aspects of index creation, key management, and key processing.

Indexes are one of many examples of how FairCom DB gives developers the control to achieve unprecedented performance with the lowest total cost of ownership (TCO).
You can learn more about indexes, as well as the binary structures, conditional indexes and column indexes here, and schedule a 20-minute FairCom DB demo and talk to one of our engineers here. Also, make sure to check out other blog post series about FairCom flexibility:
FairCom DB gives developers absolute control with custom data types
FairCom’s Low-level API gives complete control to database developers
FairCom flexibility: FairCom DB and FairCom EDGE support top programming languages