Absinthe and persisted queries

Just wondering if anyone has used https://github.com/apollographql/persistgraphql (or anything else) with absinthe to create persisted queries?

I was wondering if it would make sense to load the generated JSON into ETX/mnesia for quick lookups on the queries?

Hey!

Absinthe has supported this kind of thing for a while via the DocumentProvider behaviour https://hexdocs.pm/absinthe_plug/Absinthe.Plug.DocumentProvider.html#content

This behaviour is undergoing a bit of a re-work for 1.4.0 as it’s getting moved into the core Absinthe project itself, but the core idea will be the same.

At the moment we don’t get as many wins on the backend from this kind of thing as we would like to. In order to make the validation logic simpler, we inline variable values into the AST tree pretty early on in the execution process. This has the consequence however of limiting how much can be cached without knowing variable values.

I have a branch in progress that introduces variables a lot later, hopefully we can get that finished in the near future.

2 Likes

Ah fantastic, that is exactly what I was after - turns out I’m blind and completely missed that in the docs! :grin:

My thinking behind using it was mainly to reduce data on a mobile app.

I guess there are no real differences in doing it this way, than sending the full query/mutation?