If two data points have same partition key (same location) it should have a different sort key, and they will be stored together on single location.
Secondary Indexes: Secondary indexes allow you to perform queries on attributes that are not part of the table’s primary key. Note that global secondary index read and write capacity settings are separate from those of the table, and will incur additional costs.
Local Secondary Index – Same Partition Key + Different Sort Key ( can only be created while creating the table, cannot be added/removed or modified later)
Global Secondary Index – Different Partition Key + Different Sort Key ( can be created during the table creation or can be added later or removed / modified later)
Amazon DynamoDB synchronously replicates data across three facilities in an AWS Region, giving you high availability and data durability.
Eventually Consistent Reads
It may take 1 second before the reads return what has been written, but it will be eventually (after 1 sec) consistent
Best price performance
Strongly consistent reads
Read returns all writes that received a “successful write” response before the read is sent
If you need all your reads to be consistent with all writes (even that happened less than a second before) you will choose this model
Pricing is based reads/writes/storage only. Not by CPU usage or data transfer
Read throughput 0.000xxx $ per hour for every 40 units
Write throughput 0.000xxx $ per hour for every 10 units
Writes are 5X expensive than reads
Storage Cost 0.25$ per Gb/month
at the time of creating table choose
Provisioned Read/Write capacity units
Reserved Read/Write capacity units with 1 or 3 year contracts help you reduce costs
Push button scaling
By simply changing RCU/WCU inside the console on a table’s capacity tab
Not possible in RDS since scaling up involves some downtime in RDS
Query operation finds item in a table using only primary key attribute values, must provide partition attribute name and the value to search for
you can optionally provide a sort key attribute name and value to refine search result
By default Query returns all the data attributes for those items with specified primary keys. You can further use ProjectionExpression parameter to only return a selected attributes.
Query results are always sorted by the sort key (ascending for both numbers and string by default). To reverse the sort order set the ScanIndexForward parameter to false
By Default Queries are going to be Eventually consistent but can be changed to StronglyConsistent.
Scan operation examines every item.
by default Scan returns all the data attributes but we could use ProjectionExpression parameter to only return a selected attributes.
Query operation is more efficient than scan operation. Scan operations are less efficient than other operations in DynamoDB.
A Scan operation always scans the entire table or secondary index, then filters out values to provide the desired result, essentially adding the extra step of removing data from the result set.
Because a Scan operation reads an entire page (by default, 1 MB), you can reduce the impact of the scan operation by setting a smaller page size.
captures a time-ordered sequence of item-level modifications in any DynamoDB table,
stores this information in a log for up to 24 hours. Applications can access this log and view the data items as they appeared before and after they were modified, in near real time.
A DynamoDB stream is an ordered flow of information about changes to items in an Amazon DynamoDB table.
When you enable a stream on a table, DynamoDB captures information about every modification to data items in the table.
use to capture any kinda modification to the dynamo db table, Lambda can capture events and push notifications thru SNS
Table can be exported to csv (either select all or few items )
Encryption at rest can be enabled only when you are creating a new DynamoDB table. After encryption at rest is enabled, it can’t be disabled. Uses AWS KMS for key.
Point-in-time recovery provides continuous backups of DynamoDB table data. Once enabled, DynamoDB maintains continuous backups of your table for the last 35 days.
TTL is a mechanism to set a specific timestamp for expiring items from your table. The timestamp should be expressed as an attribute on the items in the table. The attribute should be a Number data type containing time in epoch format. Once the timestamp expires, the corresponding item is deleted from the table in the background.