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

covered indexes are not implemented for scan and order sorts

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying

      Covered indexes work with straight cursor reads, but not in memory sorts. However, explain output incorrectly states that the queries are 'indexOnly'.

      > c.find( {}, {_id:0,b:1} ).hint( {a:1,b:1} ).sort( {b:1} ).explain()
      {
      	"cursor" : "BtreeCursor a_1_b_1",
      	"nscanned" : 0,
      	"nscannedObjects" : 0,
      	"n" : 0,
      	"scanAndOrder" : true,
      	"millis" : 1,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"isMultiKey" : false,
      	"indexOnly" : true,
      	"indexBounds" : {
      		"a" : [
      			[
      				{
      					"$minElement" : 1
      				},
      				{
      					"$maxElement" : 1
      				}
      			]
      		],
      		"b" : [
      			[
      				{
      					"$minElement" : 1
      				},
      				{
      					"$maxElement" : 1
      				}
      			]
      		]
      	},
      	"server" : "Aaron-Staples-MacBook-Pro.local:27017"
      }
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            aaron Aaron Staple
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: