which of the following scenarios below are when the hint() is recommended for use with a query in MongoDB? Check all that apply:
题目选项
- A.In cases where there are multiple indexes on the collection
- B.In scenarios where there are a handful of very different indexes
- C.In scenarios where you have not already looked at the index utilization for the query
答案置信度:中
正确答案:B
解析语言:中文
只有当集合上存在"少数几个差异很大的索引"、优化器可能挑错索引时,才建议用 hint() 强制指定,故选 B。A 过于宽泛——集合上有多个索引是常态,本身并不构成使用 hint 的理由;C 恰好说反了:应当先用 explain 看索引使用情况(index utilization)再决定是否 hint,否则容易把更差的计划固化下来。