graphql-engine
graphql-engine copied to clipboard
support parallel execution of action queries
Hey,
We've assumed multiple queries in the same graphql statement would happen in parallel as per the docs. We get this behaviour with normal queries, however if the queries contain an action it seems these happen sequentially not in parallel. Is this expected behaviour?
We've assumed multiple queries in the same graphql statement would happen in parallel as per the docs.
Can you point us to the docs?
https://hasura.io/docs/1.0/graphql/manual/queries/multiple-queries.html
If multiple queries are part of the same request, they are executed in parallel, the individual responses are collated and returned. You can fetch objects of different unrelated types in the same query.
Is this only valid for pure graphql queries rather than ones that rely on actions?
This was actually a mistake in the documentation and is being fixed here: https://github.com/hasura/graphql-engine/pull/5105
Normal queries and actions, both are run sequentially.
Ah thats a shame. Are there any plans to support parallel queries? It seems to be a given that this should be the behaviour at least for actions
Yes, I think we should be able to do that in the future. Will change this issue into a feature request.
Not 100% the same feature request, but very much in the same vein: I want to run an action at the end of a CRUD operation that depends on the results of the prior operation.
It needs to be synchronous, so can't run after. The alternatives are
- Bring the CRUD logic into an action -- It seems like overkill to have to create 4 actions with a bunch of boilerplate webhook code
- Chain the requests client-side
It would be great to somehow tell Hasura to close the DB transaction before triggering the action.
Adding to this, for queries containing multiple parts, it would be a huge performance improvement (at least for some/our use case) if these could be run in parallel, rather than sequentially. In this case there should be no interdependence on each, so theres no reason I can think of for these not to run in parallel?
Any update on this request?
Hi, I want to update that we are launching Hasura V3 (DDN) this month, and it would be worth noting that parallel and batch execution is something that has been built in a great way in V3 (both queries and actions). The query tracing feature also provides a good view of this parallelisation. In V3, actions are now supported as custom Typescript code driven modules that allows for a lot of customisation around business logic and runtime parallelisation (using NodeJS executor).
On that note, we're celebrating our DDN beta launch at Hasura Dev Day on April 16 :tada: Join us to see the full power of Hasura DDN. Sign up here: https://hasura.io/dev-day. Can't make it? Sign up anyway and we'll send you the recording.