DynamoDB 中本地索引和全局索引之间的区别 [英] Difference between local and global indexes in DynamoDB
问题描述
我很好奇这两个二级索引以及它们之间的区别.很难想象这是什么样子.而且我认为,这将帮助更多的人,而不仅仅是我.
I'm curious about these two secondary indexes and differences between them. It is hard to imagine how this looks like. And I think, this will help more people than just me.
推荐答案
本地二级索引仍然依赖原始哈希键.当您提供带有 hash+range 的表时,请将 LSI 视为 hash+range1、hash+range2.. hash+range6.您还有 5 个范围属性可供查询.此外,只有一个预置吞吐量.
Local Secondary Indexes still rely on the original Hash Key. When you supply a table with hash+range, think about the LSI as hash+range1, hash+range2.. hash+range6. You get 5 more range attributes to query on. Also, there is only one provisioned throughput.
全局二级索引定义了一个新的范例 - 每个索引都有不同的哈希/范围键.
这打破了每个表一个哈希键的原始用法.这也是为什么在定义 GSI 时需要为每个索引添加预置吞吐量并为此付费的原因.
Global Secondary Indexes defines a new paradigm - different hash/range keys per index.
This breaks the original usage of one hash key per table.
This is also why when defining GSI you are required to add a provisioned throughput per index and pay for it.
有关差异的更多详细信息,请参阅 GSI公告
More detailed information about the differences can be found in the GSI announcement
这篇关于DynamoDB 中本地索引和全局索引之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!