AWS DynamoDB学习笔记

AmazonDynamoDB是一款全托管的NoSQL数据库服务,提供快速低延迟的性能,并且易于扩展。文章介绍了主键配置,包括分区键和排序键,以及如何通过分布请求来最大化吞吐量。此外,还详细讲解了全局二级索引和局部二级索引的概念及其使用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and lowlatency performance that scales with ease.

Primary Key

When you create a table, you must specify the primary key of the table in addition to the table name.
Amazon DynamoDB supports two types of primary keys, and this configuration cannot be changed after a table has been created:

Partition Key The primary key is made of one attribute, a partition (or hash) key. Amazon DynamoDB builds an unordered hash index on this primary key attribute.

Partition and Sort Key The primary key is made of two attributes. The first attribute is the partition key and the second one is the sort (or range) key.Each item in the table is uniquely identified by the combination of its partition and sort key values.It is possible for two items to have the same partition key value, but those two items must have different sort key values.
each primary key attribute must be defined as type string, number, or binary.
If you are performing many reads or writes per second on the same primary key,
you will not be able to fully use the compute capacity of the Amazon DynamoDB cluster.
A best practice is to maximize your throughput by distributing requests across the full
range of partition keys.

Secondary Indexes//重点

When you create a table with a partition and sort key (formerly known as a hash and range key), you can optionally define one or more secondary indexes on that table.

Global Secondary Index The global secondary index is an index with a partition and sort key that can be different from those on the table. You can create or delete a global secondary index on a table at any time.

Local Secondary Index The local secondary index is an index that has the same partition key attribute as the primary key of the table, but a different sort key. You can only create a local secondary index when you create a table.
While a table can only have one local secondary index, you can have multiple global secondary indexes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值