pagination - How to get total rows for cypher with skip limit? -
i able use skip, limit (and order by) fetch contents of particular page in ui. e.g. render nth page of page size m. ui asks skip n*m , limit m.
but, ui wants generate links possible pages. have return total rows available in neo4j. e.g. total p rows, ui generate hyperlink 1,2,3... (p/m).
what best(in terms of performance) way total number of rows while using skip, limit in the cypher?
in general not advisable fetching results requires fetch large swaths of graph memory.
you have 2 options:
- use simpler version of query separate count query (which might run asynchronously)
merge count query , real query one, more expensive skip-limit query, in worst case totalcount/pagesize times more expensive
start n=node:user(name={username}) match n-[:knows]->() n,count(*) total match n-[:knows]->m return m.name, total skip {offset} limit {pagesize}
Comments
Post a Comment