Updated on 2025-08-28 GMT+08:00

Index Overview

An index lets you query the data in the table using a different primary key from the base table, enabling faster and more accurate retrieval. KVS supports local and global secondary indexes. Indexes can be created, queried, and deleted.

Local Secondary Indexes

A local secondary index has the same shard key as its base table, but a different sort key. It is supported for tables with a composite primary key (shard key and sort key) and helps accelerate queries through the specified sort key. When a KV item is written, a local secondary index item is automatically generated and stored with strong consistency.

Global Secondary Indexes

A global secondary index has a different shard key from the base table. Each index item stores only the index data. Other data in the corresponding KV item is not included. When a KV item is written, an index item is automatically generated and then asynchronously written to the global secondary index with eventual consistency.

Figure 1 Index overview

You can create, query, and delete indexes.

Table 1 Index features

Feature

Description

Creating Indexes

Create indexes for a table.

Querying Indexes

Query all indexes in a table.

Deleting an Index

Delete an index during table creation.