Wednesday, April 21, 2021

DynamoDB - Basic Concepts

DynamoDB, Oracle Database Tutorial and Material, Oracle Database Exam Prep, Oracle Database Career, Database Preparation

Before using DynamoDB, you must familiarize yourself with its basic components and ecosystem. In the DynamoDB ecosystem, you work with tables, attributes, and items. A table holds sets of items, and items hold sets of attributes. An attribute is a fundamental element of data requiring no further decomposition, i.e., a field.

Primary Key

The Primary Keys serve as the means of unique identification for table items, and secondary indexes provide query flexibility. DynamoDB streams record events by modifying the table data.

More Info: 1Z0-064: Oracle Database 12c - Performance Management and Tuning

The Table Creation requires not only setting a name, but also the primary key; which identifies table items. No two items share a key. DynamoDB uses two types of primary keys −

◉ Partition Key − This simple primary key consists of a single attribute referred to as the “partition key.” Internally, DynamoDB uses the key value as input for a hash function to determine storage.

◉ Partition Key and Sort Key − This key, known as the “Composite Primary Key”, consists of two attributes.

     ◉ The partition key and

     ◉ The sort key.

DynamoDB applies the first attribute to a hash function, and stores items with the same partition key together; with their order determined by the sort key. Items can share partition keys, but not sort keys.

The Primary Key attributes only allow scalar (single) values; and string, number, or binary data types. The non-key attributes do not have these constraints.

Secondary Indexes

These indexes allow you to query table data with an alternate key. Though DynamoDB does not force their use, they optimize querying.

DynamoDB uses two types of secondary indexes −

◉ Global Secondary Index − This index possesses partition and sort keys, which can differ from table keys.

◉ Local Secondary Index − This index possesses a partition key identical to the table, however, its sort key differs.

API

The API operations offered by DynamoDB include those of the control plane, data plane (e.g., creation, reading, updating, and deleting), and streams. In control plane operations, you create and manage tables with the following tools −

◉ CreateTable

◉ DescribeTable

◉ ListTables

◉ UpdateTable

◉ DeleteTable

In the data plane, you perform CRUD operations with the following tools −

Create Read  Update  Delete 

PutItem

BatchWriteItem

GetItem

BatchGetItem

Query

Scan

UpdateItem

DeleteItem

BatchWriteItem


The stream operations control table streams. You can review the following stream tools −

◉ ListStreams
◉ DescribeStream
◉ GetShardIterator
◉ GetRecords

Provisioned Throughput


In table creation, you specify provisioned throughput, which reserves resources for reads and writes. You use capacity units to measure and set throughput.

When applications exceed the set throughput, requests fail. The DynamoDB GUI console allows monitoring of set and used throughput for better and dynamic provisioning.

Read Consistency


DynamoDB uses eventually consistent and strongly consistent reads to support dynamic application needs. Eventually consistent reads do not always deliver current data.

The strongly consistent reads always deliver current data (with the exception of equipment failure or network problems). Eventually consistent reads serve as the default setting, requiring a setting of true in the ConsistentRead parameter to change it.

Partitions


DynamoDB uses partitions for data storage. These storage allocations for tables have SSD backing and automatically replicate across zones. DynamoDB manages all the partition tasks, requiring no user involvement.

In table creation, the table enters the CREATING state, which allocates partitions. When it reaches ACTIVE state, you can perform operations. The system alters partitions when its capacity reaches maximum or when you change throughput.

Related Posts

0 comments:

Post a Comment