Dgraph DQL Tour
Pagination (first, offset and after)
It’s not uncommon to have thousands of results for a query.
But you might want to select only the top-k answers, paginate the results for display, or limit a large result.
In DQL this is done with
after in combination with
first: NReturn only the first
offset: NSkip the first
after: uidReturn the results after
By default, query answers are ordered by
uid. You can change this behavior by
explicitly specifying an order.
after makes sense in pagination when we only know the last
uid returned and
don’t record how many results have previously been retrieved.