Courseiva

C100DBA · domain

Indexing and Performance

This domain covers MongoDB index selection, compound index field order, index intersection, and the performance cost of over-indexing. Questions present real query patterns and sharded-cluster behavior, asking you to pick the most efficient index or explain why a plan scans more shards or documents than expected.

30 questions4 easy16 medium10 hard

Focused practice

Practice Indexing and Performance questions

Scored sessions drawing only from this domain — pick a length below.

Start 20-question practice test →

What this domain covers

What to know about Indexing and Performance

You must read explain() output and design compound indexes with equality fields before range fields, matching the query shape. The single most important thing is getting compound index field order right, since it determines whether MongoDB can bound the scan or must examine every candidate document.

Choosing compound index field order for equality-then-range query predicates

Using explain() to read winning plans, IXSCAN, COLLSCAN, and rejected plans

Diagnosing scatter-gather when a query does not target the shard key

Recognizing index write overhead, working set growth, and low-selectivity fields

Watch out for

Common Indexing and Performance exam traps

  • ▸Reversing compound index order so the range field precedes the equality field, forcing a less selective scan.
  • ▸Assuming any shard key filter avoids scatter-gather when the query lacks the full shard key prefix.
  • ▸Adding indexes for every queried field, ignoring write amplification and RAM pressure on the working set.

Question index

All Indexing and Performance questions (30)

Click any question to see the full explanation, or start a practice session above.

1

What is the primary benefit of using a Covered Query in MongoDB?

Medium
2

Refer to the exhibit. What does this output indicate about the query performance?

Medium
3

A DBA notices that a query on the products collection uses an index scan but returns only a small fraction of documents. The index is { category: 1, price: 1 }. The query filters on category and price with a range condition on price. Which statement best describes why the index might still be efficient despite scanning many index entries?

Easy
4

Refer to the exhibit. Which index is most effective for this query?

Hard
5

Which situation is best suited for a Multikey Index?

Medium
6

What is the consequence of having a high number of 'keysExamined' compared to 'nReturned' in a query?

Medium
7

When evaluating index performance, what is the impact of a 'partial index'?

Hard
8

A collection 'events' has a compound index { tenantId: 1, createdAt: -1 }. A developer runs db.events.find({ tenantId: "acme", createdAt: { $gte: ISODate("2024-01-01") } }).sort({ createdAt: -1 }).limit(50). The explain output shows the index is used but the query still performs a large in-memory sort. Which action resolves the sort performance issue?

Medium
9

A DBA is troubleshooting a slow query on a large collection. Which two techniques directly reduce the number of documents the query must examine for an equality-plus-range predicate? (Choose two.)

Medium
10

An e-commerce application frequently runs a query filtering by category and sorting by price descending. Which index structure provides the optimal performance for this access pattern?

Medium
11

Refer to the exhibit. An application queries active user documents frequently, but explainPlan output reveals a COLLSCAN stage. What is the most appropriate remediation step?

Hard
12

A DBA observes that a query with filter { a: 5, b: { $gt: 10 } } and sort { c: 1 } is using a collection scan despite the existence of an index { a: 1, b: 1, c: 1 }. The DBA wants to improve performance. Which action is most likely to allow the index to support both the filter and the sort?

Hard
13

When would you choose to create a Partial Index instead of a standard index?

Medium
14

Which TWO of the following scenarios are best handled by a Hashed Index?

Hard
15

A DBA needs a query that returns only the fields name and email from a 'users' collection, filtered by an equality on email, to avoid fetching full documents from disk. Which index design supports this efficiently?

Easy
16

An operations engineer notices that a frequently executed aggregation pipeline fails with a 'Exceeded memory limit for $sort' error. Which index configuration best resolves this memory constraint?

Medium
17

A DBA is designing indexes for a collection that stores user activity logs. The collection has fields: user_id, action, timestamp, and metadata (an embedded document). The most common queries are: (1) find all actions for a given user_id sorted by timestamp descending; (2) find all users who performed a specific action within a time range. Which TWO indexes would best support these queries? (Choose two.)

Medium
18

When evaluating the performance of a 'hint' in MongoDB, what should you keep in mind?

Medium
19

A collection 'logs' receives continuous inserts and is queried by both timestamp ranges and a rarely used severity field. A DBA creates six indexes to cover every query variant, and now insert throughput has dropped sharply while index sizes dominate the working set. Which action best restores insert throughput while preserving the important query paths?

Hard
20

A support team reports that a MongoDB 6.0 replica set is experiencing slow queries on a collection where almost every document has a unique value for the field status. A developer suggests creating a hashed index on status to speed up equality lookups. Which outcome should the DBA expect?

Easy
21

Refer to the exhibit. The explain output shows a SORT stage wrapping an IXSCAN stage. What is the performance implication of this execution plan?

Hard
22

An application frequently queries a large collection using two fields: 'category' (equality) and 'timestamp' (range). Which index strategy provides the most efficient execution plan?

Medium
23

A sharded cluster experiences poor query performance because a targeted query targeting a specific shard key still results in a scatter-gather operation across all shards. What is the root cause?

Hard
24

Why should you avoid creating too many indexes on a single collection?

Medium
25

A DBA is reviewing a query that performs a sort on a field named score in descending order. The collection has an index { score: 1 }. The query also includes a filter on a field named active with an equality condition. The DBA observes that the query planner chooses a collection scan and performs an in-memory sort. Which index would allow the query to use an index for both the filter and the sort?

Hard
26

Which property of a field makes it a poor candidate for an index?

Easy
27

Refer to the exhibit. A developer attempts to run a query using both 'tags' and 'location' in a single $and operation. What is the expected behavior regarding index usage?

Hard
28

A DBA needs to optimize a query that filters on a field with high cardinality, such as email, and also sorts on a low cardinality field, such as country. The query is { email: "user@example.com" } with sort { country: 1 }. Which index would best support this query?

Medium
29

An application frequently queries a large collection by 'user_id' and 'status', sorting the results by 'timestamp'. Which index provides the most efficient execution plan?

Medium
30

A MongoDB DBA observes that a query with filter { status: "active", created_at: { $gte: ISODate("2024-01-01") } } and sort { created_at: -1 } is performing a collection scan. The collection has an index { status: 1, created_at: -1 }. Which of the following best explains why the index is not being used efficiently?

Medium

Frequently asked questions

What does the Indexing and Performance domain cover on the C100DBA exam?
You must read explain() output and design compound indexes with equality fields before range fields, matching the query shape. The single most important thing is getting compound index field order right, since it determines whether MongoDB can bound the scan or must examine every candidate document.
How many questions are in this domain?
This page lists all 30 Indexing and Performance questions in the C100DBA question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
What is the best way to practise this domain?
Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
Can I practise only Indexing and Performance questions?
Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.
mongodb-dba-associate MONGODB-DBA-ASSOCIATE indexing and performance Practice Questions