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

too much data for sort() with no index, but index does exists, and run explain() it does show using BtreeCursor

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 1.8.0
    • Index Maintenance
    • None
    • ubuntu 10.04 64 bit
    • Linux

    Description

      > db.error_types.getIndexes()
      [
      {
      "name" : "id",
      "ns" : "prod_ec.error_types",
      "key" :

      { "_id" : 1 }

      },
      {
      "key" :

      { "app_id" : 1, "digest" : 1 }

      ,
      "ns" : "prod_ec.error_types",
      "background" : true,
      "name" : "app_id_1_digest_1"
      },
      {
      "key" :

      { "app_id" : 1 }

      ,
      "ns" : "prod_ec.error_types",
      "background" : true,
      "name" : "app_id_1"
      },
      {
      "key" :

      { "app_id" : 1, "app_version" : -1, "is_resolved" : 1, "updated_at" : -1 }

      ,
      "ns" : "prod_ec.error_types",
      "background" : true,
      "name" : "app_id_1_app_version_-1_is_resolved_1_updated_at_-1"
      }
      ]

      > db.error_types.find(

      { is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}

      ).sort(

      { updated_at: -1 }

      )
      error:

      { "$err" : "too much data for sort() with no index", "code" : 10129 }

      but if I run the query with explain, BtreeCursor does used. (but it seems that mongodb picked the wrong one)

      > db.error_types.find(

      { is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}

      ).sort(

      { updated_at: -1 }

      ).explain()
      {
      "cursor" : "BtreeCursor app_id_1_digest_1",
      "nscanned" : 82,
      "nscannedObjects" : 82,
      "n" : 82,
      "scanAndOrder" : true,
      "millis" : 52,
      "indexBounds" : {
      "app_id" : [
      [
      ObjectId("4d15ce1a9ea1a313dd017dba"),
      ObjectId("4d15ce1a9ea1a313dd017dba")
      ]
      ],
      "digest" : [
      [

      { "$minElement" : 1 }

      ,

      { "$maxElement" : 1 }

      ]
      ]
      }
      }

      I added hint to the query, but still the same error

      >db.error_types.find(

      { is_resolved: false, app_id: ObjectId('4d15ce1a9ea1a313dd017dba')}

      ).sort(

      { updated_at: -1 }

      ).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1")
      error:

      { "$err" : "too much data for sort() with no index", "code" : 10129 }

      > db.error_types.find(

      { is_resolved: false, app_id: ObjectId('4d15ce1a3ea7a313dd017dba')}

      ).sort(

      { updated_at: -1 }

      ).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1")
      error:

      { "$err" : "too much data for sort() with no index", "code" : 10129 }

      <4d15ce1a9ea1a313dd017dba')}).sort(

      { updated_at: -1 }

      ).hint("app_id_1_app_version_-1_is_resolved_1_updated_at_-1").explain()
      {
      "cursor" : "BtreeCursor app_id_1_app_version_-1_is_resolved_1_updated_at_-1",
      "nscanned" : 0,
      "nscannedObjects" : 0,
      "n" : 0,
      "scanAndOrder" : true,
      "millis" : 0,
      "indexBounds" : {
      "app_id" : [
      [
      ObjectId("4d15ce1a9ea1a313dd017dba"),
      ObjectId("4d15ce1a9ea1a313dd017dba")
      ]
      ],
      "app_version" : [
      [

      { "$maxElement" : 1 }

      ,

      { "$minElement" : 1 }

      ]
      ],
      "is_resolved" : [
      [
      false,
      false
      ]
      ],
      "updated_at" : [
      [

      "$maxElement" : 1
      },

      { "$minElement" : 1 }

      ]
      ]
      }
      }

      Attachments

        Activity

          People

            aaron Aaron Staple
            stonegao Stone, Gao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: