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

index scan is slower than full collection scan in some scenarios

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Query Execution
    • 0

      Tested with WiredTiger which seems to exhibit this more than MMAP.

      Covered index query which has to return all the documents from a collection is slower than just a full collection scan even in cases where index is quite small and collection is very large.

      Looking at where we spend time, it appears for each "document" we need to "synthesize" from the index we allocate and free some memory. We apparently have some optimization for avoiding that in collection scan but not full index scan. This is to track the same optimization for index scan.

        1. flame-graph-screenshot.png
          631 kB
          Kyle Suarez
        2. flame-graph-screenshot.png
          177 kB
          Kyle Suarez
        3. ixscan-flamegraph.svg
          256 kB
          Kyle Suarez
        4. Screenshot 2016-04-12 15.51.00.png
          762 kB
          Asya Kamsky
        5. Screenshot 2016-04-12 16.35.16.png
          581 kB
          Asya Kamsky
        6. Screenshot 2016-04-12 17.53.37.png
          482 kB
          Asya Kamsky
        7. Screenshot 2016-04-12 17.53.59.png
          471 kB
          Asya Kamsky
        8. time-ixscan-vs-collscan.js
          1 kB
          Kyle Suarez

            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            asya.kamsky@mongodb.com Asya Kamsky
            1 Vote for this issue
            50 Start watching this issue