[]
A table index is a field-based structure that improves the speed of record lookup operations.
Without indexes, the table must scan all records when performing a search. For large datasets, this can impact performance. By creating indexes on specific fields, the table can locate matching records more efficiently.
Indexes are particularly useful when:
A field is frequently searched.
The table contains a large number of records.
Fast lookup is required for interactive components such as TableSheet.
While indexes improve read performance, they introduce additional maintenance cost. Insert, update, and delete operations may incur slight overhead because indexed fields must be updated accordingly.
Use indexes selectively on fields that are frequently queried.
DataManager supports single-column indexes.
When you call:
table.createIndexes(["CompanyName", "City"]);The table creates independent indexes for:
CompanyName
City
Each field is indexed separately.
Indexes are created explicitly.
table.createIndexes(["CompanyName", "City"]);Indexes are not created automatically.
If no index exists on a field, search operations fall back to a linear scan.
Indexes remain valid:
After fetch()
After reloading table data
Indexes are only removed when:
table.dropIndexes(["City"]);or
table.clearIndexes();This allows you to define indexes once and reuse them across data reloads.
table.dropIndexes(["City"]);Removes indexes for the specified fields.
table.clearIndexes();Removes all indexed fields.
table.getIndexes();Returns an array of currently indexed field names.
If no indexes exist:
[]