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

Use document views rather than making copies when parsing find requests

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

      The IDL definitions of the find and aggregate commands use object_owned for some fields that are documents, which involves making a copy of subdocument's BSON data during parse. This can be expensive, especially since it is performed on every operation. anna.wawrzyniak@mongodb.com estimates that somewhere in the neighborhood of 0.3% of an entire find query's execution time could be spent on these copies.

      We should update these command definitions to use object rather than object_owned to avoid performing these copies/allocations. In order to ensure these documents don't point to invalid data once the parsed-from request goes out of scope, we can use the IDL-generated parseSharingOwnership instead of parse to ensure the parsed IDL struct keeps an anchor around. We should do this for any operation we care about the performance of, starting with at least find and aggregate.

            evan.bergeron@mongodb.com Evan Bergeron
            patrick.freed@mongodb.com Patrick Freed
            0 Vote for this issue
            7 Start watching this issue