There is active development on this feature.
In 19.0 and previous, if you add a Global Table and define it to use Bundle data (Use Bundle checkbox in quick properties), then you can right-click on individual columns and choose Optimize Column for Lookup. Then the table will keep an index for that column. However, the only feature that actually uses this index is when you do an SQL inner join with a WHERE or ON clause that compares a column of one table with an indexed column of another.
The forthcoming 19.2 release will include several improvements.
First, bundle tables will allow you to index columns either ordered or unordered. When ordered, lookup will be O(log n) (it's not a binary search, but rather a b-tree search). When unordered, lookups will be O(1).
Second, the Table interface will include two new methods:
- Variant getValueByKey( Variant key , Variant valueCol , Variant keyCol = nullvar)
- int getRowByKey( Variant key , Variant keyCol = nullvar )
These methods will lookup a value or row based on a key value. For tree-based tables or non-indexed columns, it will to a standard linear search. However, for bundle tables with indexed columns, it will do a fast lookup of those columns, either O(log n) or O(1).
Third, Table.query() will improve search speeds on single table queries, not just inner joins. For single table queries, lookup speeds will be O(1) for unordered indexed columns when you use a WHERE clause that compares an indexed column value with a constant value using the = comparison. Lookup speeds will be O(log n) for ordered indexed columns when you use a WHERE clause that compares an indexed column value with a constant value using either the =, <, >, <=, or >= comparison.