中本地索引和全局索引的区别

中本地索引和全局索引的区别

本文介绍了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.

推荐答案

Local Secondary Indexes 仍然依赖于原来的 Hash Key.当您提供带有 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 中本地索引和全局索引的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 15:16