neo4j-graphql-java
neo4j-graphql-java copied to clipboard
Inefficient ORDER BY / LIMIT / OFFSET
I have had to hack the cypher produced for queries in order to take full advantage of the FILTER_AS_MATCH when using first/limit.
I take the ORDER BY, LIMIT and OFFSET which are at the end of the RETURN statement, and move them before the RETURN (adding a WITH * to make it work). This results in ~10x fewer DB hits on our data. This is doubly important in cases where we have a lot of sub-selections in the query. There is no point loading all of the relations for this label in the database, only to return the first 5 nodes.
I have no idea if it works for all your use cases like it did mine, but the improvement is significant enough for me to bring it up.
@yarc Can you please provide a testcase with the expected query.