Choosing a data store, vectors included
DEA-C01 · Lesson 8 of 23 · 1:02:56
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DEA-C01 exam (AWS Certified Data Engineer – Associate). In this lesson: matching the store to the job (RDS and Aurora, Redshift, DynamoDB, MemoryDB, Kinesis and Amazon MSK, an S3 data lake with Lake Formation and EMR), designing for access patterns with partition keys, secondary indexes, and read replicas, embeddings and vector indexes, HNSW and IVF compared, and how an Amazon Bedrock knowledge base chunks, embeds, stores, and retrieves documents. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
One database for everything
AnyCompany Games keeps everything in one big relational database: player profiles, match events, leaderboards, and the help articles of its new support assistant. Leaderboard reads slow down every evening, nightly reports lock the tables, and the assistant cannot search the articles by meaning. This lesson covers how to match each workload to a data store, how to configure it for its access pattern, and how embeddings, vector indexes, and knowledge bases work.
Matching stores to needs
Each data store fits a different job, with a different cost and performance. Amazon RDS and Aurora run relational databases for transactions, like orders and player accounts, while Amazon Redshift is a data warehouse for analytics on large volumes, with each column stored together. Amazon DynamoDB is a serverless key-value and document database, with single-digit millisecond performance at any scale, and Amazon MemoryDB keeps all its data in memory, with microsecond reads, and stores it durably across several Availability Zones. For streams, Kinesis Data Streams and Amazon MSK hold ordered records for a set retention period, for many consumers. And a data lake in Amazon S3, with fine-grained permissions from AWS Lake Formation, and processing by Amazon EMR or Glue, keeps any format at low cost, while purpose-built stores like DocumentDB for JSON documents and Neptune for graphs cover the rest.
Access patterns
Then configure each store for its access pattern: how the data is read and written, how often, and by whom. In DynamoDB, start from the queries: the partition key spreads the items across partitions, so choose a key with many distinct values and uniform activity, like a player ID, not a date that every write shares. A sort key orders the items inside a partition, and a global secondary index adds another key to query by, like the game mode. In RDS and Aurora, read replicas take read-heavy queries, like reports, away from the primary database, while Multi-AZ keeps a standby for failover. In Redshift, Redshift Serverless adjusts capacity in seconds for volatile workloads, and you pay only while it is in use, and on EMR, keep the data in S3 rather than in HDFS on the cluster, which is lost when the cluster ends.
Vector indexes
An embedding is a vector, a list of numbers that a model computes from a text or an image, so that similar meanings get nearby vectors. To find the nearest vectors fast, a vector index trades a little recall, the share of true nearest neighbors that it finds, for a lot of speed. HNSW, for Hierarchical Navigable Small Worlds, builds a graph in several layers: it gives the best balance of speed and recall, but it takes longer to build and uses more memory. IVF, the inverted file index, divides the vectors into lists around centers, and searches only the lists closest to the query: it builds faster and uses less memory, but it needs data to train on, and its recall depends on how many lists each query probes. With the pgvector extension, Aurora PostgreSQL supports both index types, OpenSearch Service runs k-nearest neighbor search, and MemoryDB serves vector search from memory, with very low latency.
Knowledge bases
A knowledge base in Amazon Bedrock builds this whole pipeline for retrieval augmented generation, or RAG. It reads documents from a data source like S3, and splits them into chunks, of about three hundred tokens by default, or with fixed-size, hierarchical, or semantic chunking. An embedding model turns each chunk into a vector, and the knowledge base stores the vectors and the text in a vector store, like OpenSearch Serverless or Aurora PostgreSQL. At query time, the question becomes a vector too, the closest chunks are retrieved, and they are added to the prompt, so that the model answers from your documents. When files are added, changed, or removed, you sync the data source, and the sync is incremental: only those documents are processed again.
A store for each need
Here is the new design at AnyCompany Games: player profiles move to DynamoDB, keyed by player ID, and real-time leaderboards to MemoryDB, read in microseconds. Orders stay in Aurora, with a read replica for the nightly reports, and match events stream through Kinesis into the S3 data lake, governed by Lake Formation. Redshift holds the curated tables for the analysts, and EMR runs the heavy Spark jobs on the lake, then shuts down. And the help articles feed a Bedrock knowledge base, with an HNSW index in Aurora PostgreSQL, for the support assistant.
Recap
Let's recap. Match the store to the job: RDS and Aurora for transactions, Redshift for analytics, DynamoDB for key-value access at any scale, MemoryDB for microsecond reads, Kinesis and MSK for streams, and S3 with Lake Formation and EMR for the data lake. Design for the access pattern, with a partition key of many distinct values, secondary indexes, and read replicas. Embeddings are vectors, and a vector index trades a little recall for speed. HNSW is fast with high recall, but uses more memory, while IVF builds faster with less memory, after training on data. And a Bedrock knowledge base chunks, embeds, stores, and retrieves your documents.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A DynamoDB table stores match events with the match date as its partition key. Every write of the day goes to the same key, and writes are throttled. What should the data engineer change?
- Raise the read capacity of the table
- Add a global secondary index on the date
- Use the match ID as the partition key
- Switch the table to the Standard-IA class
Show the answer
Use the match ID as the partition key
The match ID has many distinct values, so the writes spread across partitions instead of hitting one. “Raise the read capacity of the table” would add read capacity, while the problem is the writes. “Add a global secondary index on the date” would still use the date as a key, so the index would get hot too. And “Switch the table to the Standard-IA class” would only change the storage price, not how the writes are spread.
The support assistant must answer from 20,000 help articles in S3, with the least custom code for chunking, embeddings, and retrieval. What should the data engineer use?
- A Glue job that loads the articles into Redshift
- A DynamoDB table keyed by article title
- Athena queries with LIKE filters on the files
- A Bedrock knowledge base on the S3 bucket
Show the answer
A Bedrock knowledge base on the S3 bucket
A knowledge base chunks the articles, creates the embeddings, stores them in a vector store, and retrieves the closest chunks at query time. “A Glue job that loads the articles into Redshift” would load the text into a warehouse, without any search by meaning. “A DynamoDB table keyed by article title” is for finding an item by its exact key, not by a similar meaning. And “Athena queries with LIKE filters on the files” would match words, not meaning, and it would not prepare any chunks for the model.
A vector table in Aurora PostgreSQL holds 5 million embeddings, and a chatbot queries it constantly. The team wants the best balance of speed and recall, and memory is not a concern. Which index should the team create?
- An HNSW index with the pgvector extension
- An IVF index with a single list
- A B-tree index on the embedding column
- No index, exact search on every single query
Show the answer
An HNSW index with the pgvector extension
HNSW gives the best balance of speed and recall, and its extra memory and build time are not a concern here. “An IVF index with a single list” would put every vector in one list, so each query would scan them all. “A B-tree index on the embedding column” is for sorting and exact matches, not for nearest neighbor search. And “No index, exact search on every single query” would give perfect recall, but every query would compare all five million vectors.