M101P: MongoDB for Developers - Chapter 4: Performance
2016-08-29 19:43
453 查看
Homework 4.1
(OK)db.products.find( { $and : [ { price : { $gt : 30 } }, { price : { $lt : 50 } } ] } ).sort( { brand : 1 } )
db.products.find( { 'brand' : "GE" } )
db.products.find( { brand : 'GE' } ).sort( { category : 1, brand : -1 } )
(OK)
db.products.find( { 'brand' : "GE" } ).sort( { price : 1 } )
Homework 4.2
(OK) The query uses an index to determine the order in which to return result documents.The query uses an index to determine which documents match.
(OK) The query examines 251120 documents.
The query returns 251120 documents.
The query is a covered query.
Homework 4.3
db.posts.createIndex({date:-1}) db.posts.createIndex({tags:1,date:-1}) db.posts.createIndex({permalink:1})
Homework 4.4
> db.profile.find().sort({millis:-1}).limit(1).pretty() { "_id" : ObjectId("57c41c92adaa1d1ee896b853"), "ts" : ISODate("2012-11-20T20:09:49.862Z"), "op" : "query", "ns" : "school2.students", "query" : { "student_id" : 80 }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 10000000, "keyUpdates" : 0, "numYield" : 5, "lockStats" : { "timeLockedMicros" : { "r" : 19776550, "w" : 0 }, "timeAcquiringMicros" : { "r" : 4134067, "w" : 5 } }, "nreturned" : 10, "responseLength" : 2350, "millis" : 15820, "client" : "127.0.0.1", "user" : "" }
15820
-eof-
相关文章推荐
- M101P: MongoDB for Developers - Chapter 1: Introduction
- M101P: MongoDB for Developers - Chapter 2: CRUD
- M101P: MongoDB for Developers - Chapter 3: Schema Design
- M101P: MongoDB for Developers - Final Exam
- M101P: MongoDB for Developers - Chapter 5: Aggregation Framework
- M102: MongoDB for DBAs chapter 2学习记录
- M102: MongoDB for DBAs chapter 2学习记录
- M102: MongoDB for DBAs chapter 1学习记录
- M102: MongoDB for DBAs chapter 2学习记录
- M102: MongoDB for DBAs chapter 1学习记录
- Language Basics(Chapter 3 of Professional JavaScript® for Web Developers 2nd Edition)
- Pro ASP.NET for SQL Server: High Performance Data Access for Web Developers
- MongoDB for node.js developers 七周学习-最终测试小结(1)
- M102: MongoDB for DBAs chapter 2学习记录
- M102: MongoDB for DBAs chapter 1学习记录
- M102: MongoDB for DBAs chapter 2学习记录
- M102: MongoDB for DBAs chapter 1学习记录
- Variables, Scope, and Memory(Chapter 4 of Professional JavaScript® for Web Developers 2nd Edition)
- Napkin math for MongoDB performance
- M102: MongoDB for DBAs - Chapter 4: Replication