AWS DynamoDB学习笔记

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.

你可能感兴趣的:(AWS)