How to paginate results of cypher, neo4j?

Hello,

i am currently working with neo4j, if anybody knows how to do pagination with the results that a cypher query gives, specialy the size of the results is so big, about 100 millions.

i know the methode of skip and limit and order by (which is not good, it takes a long time). so is there anyone knows another efficient methode to do the pagination.

thank you in advance.

SKIP and LIMIT are indeed how pagination is done for results in Neo4j. SKIP effectively controls where to start (which page number you're one) and LIMIT controls how many are on a page.

SKIP and LIMIT themselves are very fast, so if you're experiencing slowness issues this may be due to the query you're paginating rather than the pagination itself. I recommend doing an EXPLAIN on the query to see the plan, and look for ways of improving the query to minimize dbHits.

Hello,

Firstly, thank you for replying to me.

How to use a variable with SKIP ( for calculing the number for rows to skip).

I was talking about ORDER BY when i said it slows the execution, so please, is there a way to retreive the data without duplicate the same data in two different querys of (SKIP, LIMIT) without using ORDER BY.

Thank you in advance.

To use a variable, these are called "parameters" in cypher queries.

In Neo4j browser for example you can do this:

:set n => 5

MATCH (node) RETURN node LIMIT $n

If you are using an official driver with neo4j, look into the docs for your language on how to use parameters in your cypher queries. All official drivers support this and will do that.

As for your order by question - I'm not sure. It would help if you post the cypher. Please open another question thread on that (because the title of this one will not attract other help on an order by topic). Post your cypher, and state what you're trying to make happen

Hello, thank you for replying to me.

So, i create another topic like you said to me, here is the link : Neo4j : Using ORDER BY with SKIP and LIMIT, is it the better way to get a good performance ( execution time)?

Thank you in advance.