Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9077

How to optimize the query

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • None
    • None
    • Querying
    • None
    • Linux

    Description

      I have a capped collection with 1.3 million documents indexed on id.
      When i do a query with a filter it takes more than 1 minute to give back the result. The query includes find with sort on id and limit(20).
      I need to get back the query result in max 30-45 seconds.
      Let me know what enhancements can be done.
      Below is explain output from shell. Same query i use from perl driver

      {
      	"cursor" : "BtreeCursor _id_ reverse",
      	"isMultiKey" : false,
      	"n" : 0,
      	"nscannedObjects" : 1308194,
      	"nscanned" : 1308194,
      	"nscannedObjectsAllPlans" : 2616388,
      	"nscannedAllPlans" : 2616388,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 72,
      	"nChunkSkips" : 0,
      	"millis" : 109349,
      	"indexBounds" : {
      		"_id" : [
      			[
      				{
      					"$maxElement" : 1
      				},
      				{
      					"$minElement" : 1
      				}
      			]
      		]
      	},

      Thanks

      Attachments

        Activity

          People

            Unassigned Unassigned
            asethy Arati Sethy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: