Database Flashcards
Define DynamoDB.
DynamoDB Flashcards: Core Concepts
A fully managed, serverless, key-value NoSQL database offering high performance and scalability for any scale.
What are the core components of DynamoDB?
Tables, Items, Attributes, and Primary Keys (Partition Key or Partition Key + Sort Key)
Explain the function of a DynamoDB Partition Key.
Distributes data across partitions, ensuring even distribution and efficient data access. Must be unique for each item.
What role does a Sort Key play?
Organizes data within a partition, enabling range queries and sorting within a partition.
What data types does DynamoDB support?
Scalar (String, Number, Binary, Boolean, Null), Document (List, Map), and Set types (String Set, Number Set, Binary Set).
Differentiate between Provisioned and On-Demand capacity modes.
- Provisioned: User defines read/write capacity units (RCUs/WCUs). Offers cost predictability.
- On-Demand: DynamoDB automatically scales capacity. Ideal for unpredictable workloads.
What are the benefits of DynamoDB Streams?
Capture item-level modifications (create, update, delete) for real-time reactions, analytics, cross-region replication, and other event-driven architectures.
How does DynamoDB Time To Live (TTL) work?
Automatically deletes items after a defined time period based on a “Number” attribute containing the Unix Epoch timestamp.
How do you write data to DynamoDB?
Using PutItem (create or replace), UpdateItem (modify existing), and BatchWriteItem (for multiple items).
Explain Conditional Writes in DynamoDB.
Allow write operations only if specific conditions are met, preventing unintended overwrites and supporting atomic operations.
What are the primary ways to read data from DynamoDB?
GetItem (retrieve by primary key), Query (retrieve items based on partition key and optional sort key conditions), Scan (scan the entire table with optional filters).
What is the purpose of BatchGetItem?
Retrieves multiple items from one or more tables in a single API call, improving efficiency.
Compare Eventually Consistent Reads and Strongly Consistent Reads.
- Eventually Consistent: May return stale data due to replication lag. Higher performance, lower cost.
- Strongly Consistent: Guarantees the latest data. Consumes more RCUs.
How do you delete data in DynamoDB?
DeleteItem (delete a single item), BatchWriteItem (delete multiple items), DeleteTable (delete the entire table).
What are Local Secondary Indexes (LSIs)?
Alternative sort keys for a table, using the same partition key as the base table. Defined at table creation.