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

Index bounds are not detected correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.4.2
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None

      Description

      Documents with two fields: {sort:..,x:...}
      Index on {sort:1,x:1}

      The query on "x" sorted by the sort field doesn't detect proper index bounds for x:

      > db.test.find({x:{$gte:1,$lte:3}}).sort({sort:1}).explain("executionStats").executionStats.executionStages.inputStage.indexBounds
      { "sort" : [ "[MinKey, MaxKey]" ], "x" : [ "[MinKey, MaxKey]" ] }
      

      However, adding an all-inclusive condition on "sort" into the query fixes the problem:

      > db.test.find({sort:{$gte:MinKey},x:{$gte:1,$lte:3}}).sort({sort:1}).explain("executionStats").executionStats.executionStages.inputStage.indexBounds
      { "sort" : [ "[MinKey, MaxKey]" ], "x" : [ "[1.0, 3.0]" ] }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.storch David Storch
              Reporter:
              alex.komyagin Alexander Komyagin
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: