Creating secondary indexes in row tables
Written by
Updated at November 26, 2024
For operations with a table indexyandex_ydb_table_index
resource.
Note
When modifying a secondary index, the old index is deleted and a new one is created.
yandex_ydb_table_index
resource
Description of the Usage example for yandex_ydb_table_index
:
resource "yandex_ydb_table_index" "ydb_table_index" {
table_path = "test_dir/test_table_3_col" # path example relative to the database root
connection_string = yandex_ydb_database_serverless.database1.ydb_full_endpoint # DB connection example
name = "my_index"
type = "global_sync" # "global_async"
columns = ["a", "b"]
cover = ["c"]
}
The following fields are supported:
Field name | Type | Description |
---|---|---|
table_path |
string |
Table path. Specified if table_id is not set. |
connection_string |
string |
DB connection string. Specified if table_id is not set. |
table_id |
string |
Terraform ID of the table. Specified if neither table_path nor connection_string is set. |
name |
string required |
Index name |
type |
string required |
global_sync / global_async |
columns |
list(string) required |
Ordered list of names of columns involved in the index |
cover |
list(string) required |
List of additional columns for the covering index |