⚡️ Pass with Confidence Sale - 40% off ALL packages! ⚡️

1 day, 22 hours remaining!

CompTIA Data+ DA0-002 (V2) Practice Question

A PostgreSQL 15 database hosts a sales table with more than 10 million rows:

sale_id          BIGINT  (PK)
product_id       INT
quantity         INT
transaction_date DATE
store_id         INT

Analysts run this parameterized query dozens of times per hour:

SELECT product_id, SUM(quantity) AS total_qty
FROM   sales
WHERE  transaction_date BETWEEN :start_date AND :end_date
GROUP  BY product_id;

The query currently performs a sequential scan and finishes in about 45 seconds. Apart from the primary-key index on sale_id, no other indexes exist. You must speed up the query without rewriting it. Which indexing strategy is most likely to cut execution time to under a second?

  • Create a hash index on product_id.

  • Create a composite B-tree index on (transaction_date, product_id).

  • Create a B-tree index on quantity.

  • Create a GIN index on product_id for full-text search.

CompTIA Data+ DA0-002 (V2)
Data Acquisition and Preparation
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot