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

[spec] Aggregate queries #1

Open
GertSallaerts opened this issue Feb 17, 2018 · 1 comment
Open

[spec] Aggregate queries #1

GertSallaerts opened this issue Feb 17, 2018 · 1 comment

Comments

@GertSallaerts
Copy link
Member

To allow for more efficient cross-service queries, it would help if AQL provided some way to aggregate results.

Say, you have two micro-services in a social media platform. One of them stores your users. The other stores posts. You would like to ask the user service for a list of users who have commented on post A.

So you construct an AQL query and send it to the user service. In the current AQL spec, the user service would have to request all comments of post A and then start extracting a list on unique user-id's from the comments. With this list it can create a filter on its own datastore saying it only wants people who's ID is in the list of commenters.

The problem here is that one person can leave multiple comments. What follows is that a lot of redundant data is communicated between both services. It might also mean lots of extra requests if paging is involved.

If however, the AQL query allowed you to specify that you only wanted a list of unique comment.authorId values that match your query (comments on post A). The resulting data-flow could be significantly smaller.

@GertSallaerts
Copy link
Member Author

GertSallaerts commented Feb 17, 2018

The Graphcool framework(?) achieves this by building on top of GraphQL:
https://blog.graph.cool/designing-powerful-apis-with-graphql-query-parameters-8c44a04658a9

GraphQL also supports mutations, but unless I'm mistaken, it does not support mass mutations. (applying the same mutations to every object that matches the condition)

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

1 participant