Payload in subscription

Why does subscription query return all the nodes in the result everytime a new node has been created? This increases the payload a lot.

Is there an efficient way to fetch only the data that has changed? Like only the add, update or deleted node?


Hi @yodaheis,

Thanks for the question. Awesome to see you here in the community!

Currently, Dgraph only supports subscriptions that return the result of a query at regular intervals. Would you mind elaborating on what you are trying to build?


Hi Tejas,

Like even for a simple chat application, everytime a new message has been added, the subscription query will return all the messages, instead of the new message(s) added.
What if I want to get messages sent after the last one I have received?
I can think of a couple of ways to workaround this, by structuring the query with parameters, but there are many limitations around it, especially since there is no cursor as a filter parameter

Same question, if the chat has thousands of messages would be nice to only get the deltas. Otherwise this will generate a ton of traffic as every new message will resend the entire data set correct?

Hey @timcash & @yodaheis ,

It seems the solution is just a query with filter.

Refer to answer by @pawan :

@abhijit-kar, filter in GraphQL is limited to indexes on scalar types only. and cannot use subscription on custom DQL

Since CDC is now available, when can we expect delta updates for GraphQL subscriptions?

This is crucial for a whole class of applications.

This will probably be a while out as the whole subscription functions would need rebuilt. And there a ton of other pressing matters such as security concerns and bug fixes

Thanks for the update! Still, it’s nice to know it’s still in the pipeline somewhere🙌🏻

Oh, no I think you misunderstood me… there is NO pipeline right now. I was just saying to not expect this any time soon.