How to paginate query results with cypher?

sunix picture sunix · May 2, 2013 · Viewed 11.5k times · Source

Is it possible to have cypher query paginated. For instance, a list of products, but I don't want to display/retrieve/cache all the results as i can have a lot of results.

I'm looking for something similar to the offset / limit in SQL.

Is cypher skip + limit + orderby a good option ? http://docs.neo4j.org/chunked/stable/query-skip.html

Answer

tstorms picture tstorms · May 2, 2013

SKIP and LIMIT combined is indeed the way to go. Using ORDER BY inevitably makes cypher scan every node that is relevant to your query. Same thing for using a WHERE clause. Performance should not be that bad though.