indexedTable#

swordfish.function.indexedTable()#

Create an indexed table, which is a special type of in-memory table with primary key. The primary key can be one column or multiple columns. The indexed table uses a red-black tree to store the primary key index. During queries, as long as the query conditions include the first column of the primary key, data can be located through the index without performing a full table scan. It is recommended to use sliceByKey to improve query performance.

When adding new records to the table, if the primary key of the new record duplicates an existing record, the system updates the record in the table; otherwise, the new record is added to the table.