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

Reduce performance impact of DocumentSourceCursor batching

    XMLWordPrintable

    Details

      Description

      On a large collection with index on "orderdate" compare find and equivalent aggregate first batches:

      command: find { find: "orders", filter: { orderdate: { $gte: new Date(759024000000) } }, sort: { orderdate: -1.0 }, projection: { _id: 0.0, orderdate: 1.0 } } planSummary: IXSCAN { orderdate: 1 } cursorid:53712819499 keysExamined:101 docsExamined:0 numYields:0 nreturned:101 reslen:2903  0ms
      command: aggregate { aggregate: "orders", pipeline: [ { $match: { orderdate: { $gte: new Date(759024000000) } } }, { $sort: { orderdate: -1.0 } }, { $project: { _id: 0.0, orderdate: 1.0 } } ], cursor: {} } planSummary: IXSCAN { orderdate: 1 } cursorid:52250968997 keysExamined:20972 docsExamined:0 numYields:163 nreturned:101 reslen:2903 11ms
      

      The main performance difference seems to come from keysExamined which is 101 in case of find and equal to I'm not sure what in the second case (there are 2406 distinct orderdate values, collection size is 1500000 and this filter reduces it to 1034289 documents).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: