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. time-ixscan-vs-collscan.js
          1 kB
        2. Screenshot 2016-04-12 17.53.59.png
          Screenshot 2016-04-12 17.53.59.png
          471 kB
        3. Screenshot 2016-04-12 17.53.37.png
          Screenshot 2016-04-12 17.53.37.png
          482 kB
        4. Screenshot 2016-04-12 16.35.16.png
          Screenshot 2016-04-12 16.35.16.png
          581 kB
        5. Screenshot 2016-04-12 15.51.00.png
          Screenshot 2016-04-12 15.51.00.png
          762 kB
        6. ixscan-flamegraph.svg
          256 kB
        7. flame-graph-screenshot.png
          flame-graph-screenshot.png
          177 kB
        8. flame-graph-screenshot.png
          flame-graph-screenshot.png
          631 kB

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            1 Vote for this issue
            Watchers:
            51 Start watching this issue

              Created:
              Updated: