admin管理员组

文章数量:1531525

M312: Diagnostics and Debugging Final Exam学习记录

运行环境

操作系统:windows 10 家庭中文版
Mongodb :Mongodb 3.4

Mongodb安装路径:E:>MongoDB\Server\3.4\bin\
Mongodb存储路径:E:>MongoDB\data

课后问题

Question 1

Which of the following is/are true of performance drops in MongoDB?

  • Background index builds may result in a drop in performance.
  • db.currentOp() can be used to find long-running processes.
  • If the .explain() plan is showing that a query is using an index, then that query has definitely been fully optimized.

解答

  • Background index builds may result in a drop in performance.

后台索引构建可能会导致性能下降。正确。
后台索引构建涉及从标准数据库操作分配资源。他们允许读取和写入来完成,但它们仍然可能是昂贵的操作。这就是为什么在生产中可以优先考虑滚动索引。

  • db.currentOp() can be used to find long-running processes.

db.currentOp()可用于查找长时间运行的进程。正确。
按照定义,一个长期运行的进程将会持续一段时间。 db.currentOp()可能会找到它,并且还可以找到进程运行的秒数,除非它在命令可以运行之前结束。

  • If the .explain() plan is showing that a query is using an index, then that query has definitely been fully optimized.

如果.explain()计划显示查询正在使用索引,那么该查询已经完全优化。错误。
下面是一个很好的例子,它使用了一个索引,但是:
(1)服务器接触到的文档中有99%用来完成这个查询,而不是由查询返回
(2)执行内存中的排序而无法使用更好的索引:

    use m312;
    db.poorlyUsedIndex.drop();
    for (k=1; k<=100; k++) { for (j=1; j<=100; j++) { docs = []; for (i=1; i<=100; i++) { docs.push( { a : i, b : j, c : k } ) }; db.poorlyUsedIndex.insertMany(docs) } };
    db.poorlyUsedIndex.createIndex( { a : 1 } );
  

本文标签: DiagnosticsdebuggingExamfinal