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

It's possible to fail on sort memory overflow even if there is an alternative plan that requires no sort.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 3.0.3
    • None
    • Querying
    • None
    • QuInt B (11/02/15)

    Description

      With a collection that has two indexes like:
      1) a_1_b_1_c_1
      2) c_1_b_1_a_1

      If you run a query like: {a: { "$in": [1]}, b:1, c: { "$in": [1,2,3]}}).sort({c:1}), a query shape will be cached with the associated plans that do no require sort and it is likely that the plan using the a_1_b_1_c_1 will get the top score.

      If you now run query like: {a: { "$in": [1,2,3]}, b:1, c: { "$in": [1,2,3]}}).sort({c:1}), the cached plan with top score will be used. As the query requires SORT stage, the plan will be re-adjusted, however if at the sort stage we hit the 32Mb limit, the query will fail despite the fact that there is an alternative plan cached that uses the c_1_b_1_a_1 index, which if used, will require no sort and re-adjustment.

      Attachments

        Issue Links

          Activity

            People

              david.storch@mongodb.com David Storch
              dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: