Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inefficient ORDER BY / LIMIT / OFFSET #253

Open
yarc opened this issue Nov 16, 2021 · 1 comment
Open

Inefficient ORDER BY / LIMIT / OFFSET #253

yarc opened this issue Nov 16, 2021 · 1 comment
Labels
wait for answer Further information is requested

Comments

@yarc
Copy link

yarc commented Nov 16, 2021

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.

@Andy2003
Copy link
Collaborator

@yarc Can you please provide a testcase with the expected query.

@Andy2003 Andy2003 added the wait for answer Further information is requested label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait for answer Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants