Courseiva
Workload-Specific Database DesignhardMultiple ChoiceObjective-mapped

DBS-C01 Workload-Specific Database Design Practice Question

A healthcare company stores patient records in Amazon DynamoDB. Each record includes a 'patient_id' (partition key) and 'visit_date' (sort key). The company needs to run ad-hoc queries to find all patients seen by a specific doctor within a date range. Which design approach minimizes cost and latency for this query pattern?

⚠ Common exam trap

Many candidates confuse LSIs and GSIs, assuming an LSI can support queries on any attribute, but LSIs are restricted to the same partition key as the base table, making them unsuitable for querying by doctor_id across all patients.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a global secondary index (GSI) with doctor_id as partition key and visit_date as sort key.

A Global Secondary Index (GSI) with doctor_id as the partition key and visit_date as the sort key allows efficient key-based queries for all patients seen by a specific doctor within a date range. This avoids full table scans and filter operations, minimizing both cost (read capacity units) and latency. DynamoDB can directly retrieve the indexed items without scanning the base table.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Query the base table using a filter expression on doctor_id.

    Why it's wrong here

    Query requires partition key; patient_id is partition key, can't filter efficiently.

  • Create a local secondary index (LSI) with doctor_id as sort key.

    Why it's wrong here

    LSI shares the same partition key (patient_id), so cannot query by doctor alone.

  • Create a global secondary index (GSI) with doctor_id as partition key and visit_date as sort key.

    Why this is correct

    GSI enables efficient query by doctor and date range.

  • Use a Scan operation with a filter expression for doctor_id and visit_date.

    Why it's wrong here

    Scan reads all items, which is costly and slow.

About these practice questions

One of 1,663 original DBS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DBS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DBS-C01 exam.