MongoDB DBA · Question 373 · Multiple choice

which of the following scenarios below are when the hint() is recommended for use with a query in MongoDB? Check all that apply:

Answer options

  1. A.
    In cases where there are multiple indexes on the collection
  2. B.
    In scenarios where there are a handful of very different indexes
  3. C.
    In scenarios where you have not already looked at the index utilization for the query

Answer confidence: Medium

Correct answer: B

Explanation language: Chinese

只有当集合上存在"少数几个差异很大的索引"、优化器可能挑错索引时,才建议用 hint() 强制指定,故选 B。A 过于宽泛——集合上有多个索引是常态,本身并不构成使用 hint 的理由;C 恰好说反了:应当先用 explain 看索引使用情况(index utilization)再决定是否 hint,否则容易把更差的计划固化下来。

Papers containing this question

This question appears in 2 bank records. Public pages combine identical prompts and options. Selected questions display the highest-confidence record; the others show a short preview. Paper-based learning preserves each record's answer, explanation, and confidence.

AUTHOR · PROJECTS · OPEN SOURCE

Author & MongoDB projects

Building data platforms, MongoDB migration and sync tools, and cloud operations products.

Contact the author for any MongoDB needs.

Contact the author ↗mlhp123@outlook.com

Support the author

If this question bank helps you, optional donations are welcome.

Scan with Alipay to support the authorOpen full-size donation image ↗