[]
        
(Showing Draft Content)

Indexes of Table

Purpose

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.

Single-Column Indexes

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.

Creating Indexes

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.

Index Persistence

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.

Managing Indexes

Drop Specific Indexes

table.dropIndexes(["City"]);

Removes indexes for the specified fields.

Clear All Indexes

table.clearIndexes();

Removes all indexed fields.

Inspect Indexed Fields

table.getIndexes();

Returns an array of currently indexed field names.

If no indexes exist:

[]