Skip to content

[FEATURE] Use find() instead of aggregate() for simpler queries when possible to enhance performance #240

Open
@andiemontoyeah

Description

@andiemontoyeah

Is your feature request related to a problem? Please describe.

Aggregation is always used even in queries where find() would have been sufficient.
In general, find() is often faster than using the aggregation framework and always makes use of indexes. The $match stage for aggregation can only use an index to filter documents if it occurs at the beginning of a pipeline which is not always the case.

Describe the solution you'd like

There is already some work in place in the Calcite adapter to determine a filter and projection document for a possible find() operation but these values are not used. If the query does not require additional operations that are only supported in the aggregation framework then the query execution should be done using find().

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions