Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance request to a query with an include #4984

Closed
matthewchung74 opened this issue Aug 17, 2018 · 3 comments
Closed

performance request to a query with an include #4984

matthewchung74 opened this issue Aug 17, 2018 · 3 comments

Comments

@matthewchung74
Copy link

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.

@doender
Copy link

doender commented Nov 13, 2018

@foobar8675 We are running into the same issue. Did you create a workaround yourself by splitting this into 2 queries?

@oallouch
Copy link
Contributor

If you could try with 10 comments and 10 users, you would see better.

@matthewchung74
Copy link
Author

matthewchung74 commented Nov 13, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants