我在spanner中有一张表,DDL如下
CREATE TABLE orders_pii(
order_id STRING(64) NOT NULL,
retailer_id STRING(64) NOT NULL,
site_id STRING(64) NOT NULL,
shipping_labels ARRAY<STRING(MAX)>,
order_creation_timestamp TIMESTAMP NOT NULL,
order_stage_by_timestamp TIMESTAMP NOT NULL,
) PRIMARY KEY(order_id, retailer_id, site_id)
我读了扳手的文档,上面写着
Spanner automatically creates an index for each table's primary key. For example, you don't need to do anything to index the primary key
但在我的例子中,主键是 3 列的组合 那么索引是分别为所有三列创建还是直接为主键(3 列的组合)创建。
我需要为这3列创建单独的索引吗?
系统会自动为这三列创建一个唯一索引。您不需要为此手动添加任何其他索引。