DynamoDB - 当我删除 GSI 中的对象时会发生什么?它 "Cascade" 到主要 table 吗?
DynamoDB - What happens when I delete a object in a GSI? Does it "Cascade" to the main table?
假设在我的主要 table 中,我有具有以下模式的对象:
Partition Key = user_user@email.com
Range Key = project_001
Role = owner
这是一个简单的对象,说明特定用户在特定项目中的角色。
但是后来我想获得一个项目中的所有用户角色,所以我制作了一个 GSI,它使用 Range Key Begins With "user_"
反转了键的顺序
Partition Key = project_001
Range Key = user_user@email.com
Role = owner
但是当我删除这个 GSI 中的对象时会发生什么?它会删除它从主 table 复制的相应对象吗?或者我需要手动保持它们同步吗?
您不能通过 GSI 删除。
DeleteItem() 只接受 table 名称。
这将向下级联到 GSI。
假设在我的主要 table 中,我有具有以下模式的对象:
Partition Key = user_user@email.com
Range Key = project_001
Role = owner
这是一个简单的对象,说明特定用户在特定项目中的角色。
但是后来我想获得一个项目中的所有用户角色,所以我制作了一个 GSI,它使用 Range Key Begins With "user_"
Partition Key = project_001
Range Key = user_user@email.com
Role = owner
但是当我删除这个 GSI 中的对象时会发生什么?它会删除它从主 table 复制的相应对象吗?或者我需要手动保持它们同步吗?
您不能通过 GSI 删除。
DeleteItem() 只接受 table 名称。
这将向下级联到 GSI。