【发布时间】:2020-08-26 05:27:11
【问题描述】:
我是 DynamoDB 架构设计的新手。我们有一个表,用于存储客户的元数据信息,其中 HashKey 为 CustomerId。该表还包括一个名为“isActive”的属性,它不是布尔值。如果客户取消注册,我们计划将“isActive”属性设置为空。
我们希望提取所有活跃的 customerIds 的列表。我读到了“sparseIndexes”,其中我们可以在“isActive”属性上创建一个 GSI,并且只有具有“非空”值的记录才会填充到 GSI 中。
但是,扫描似乎是检索活动客户 ID 列表的唯一方法。我们也可以
a) Scan entire table and filter only active customerIds at application layer
b) Scan the GSI which will be smaller than base table, but not necessarily very small (I would expect at least 1000+ records in it).
有没有更好的设计方法通过实现高基数来解决这个问题?
【问题讨论】:
标签: amazon-web-services amazon-dynamodb dynamodb-queries