covered indexes are not implemented for scan and order sorts

XMLWordPrintableJSON

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

      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
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: