Skip to content

performance request to a query with an include  #4984

Closed
@matthewchung74

Description

@matthewchung74

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

My feature is a performance request

I have a snippet of code

var query = new Parse.Query(MyComment);
query.include("user");
query.find().then(function (results) { ... }

where there are 2 MyComments each have a pointer to 2 a different user. I ran the request with my mongod set to verbose. In those logs, I see

2018-08-16T18:40:47.131-0700 I COMMAND  [conn1] command dev._User command: find { find: "_User", filter: { _id: "1BoyKbmjuW" }, ...
2018-08-16T18:40:47.156-0700 I COMMAND  [conn2] command dev._User command: find { find: "_User", filter: { _id: { $in: [ "1BoyKbmjuW", "KmbsMaQscS" ] }, ...

which makes me assume parse-server did an db query for the comments, then a separate query for each included user for a total of 3 queries. if i am understanding correctly, this would get pretty slow when there are 10+ comments.

Describe the solution you'd like

would it be possible to do all the includes in one request? i believe programmatically we could construct one query with a series of or statements such that request above would only result in 2 queries to the db.

Additional context
I am quite new to parse-server so please tell me if i am misunderstanding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions