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

How to optimize a query with a large number of hops #249

Open
LianxinGao opened this issue Aug 11, 2022 · 1 comment
Open

How to optimize a query with a large number of hops #249

LianxinGao opened this issue Aug 11, 2022 · 1 comment

Comments

@LianxinGao
Copy link
Contributor

Like cypher:

MATCH (:Country)<-[:IS_PART_OF]-(:City)<-[:IS_LOCATED_IN]-(:Person)<-[:HAS_MEMBER]-(:Forum)-[:CONTAINER_OF]->(:Post)<-[:REPLY_OF]-(:Comment)-[:HAS_TAG]->(:Tag)-[:HAS_TYPE]->(:TagClass)
RETURN count(*) AS count

This query has 7 hops, if each hop has 100 data, then total data will be (100)^7, it's a huge amount of data. Besides, currently, we will deserialize all the data's properties, so OOM will happen.....

@LianxinGao
Copy link
Contributor Author

LianxinGao commented Aug 11, 2022

My idea is:

  1. optimize the query in lynx, if we only need to get the count number, then when move to the next hop, we can drop the previous data?
  2. optimize the data structure, use lazy node and lazy relationship( do not deserialize the properties, just use the id...)

@chunyang-wen @zyang-tudb @xuanying2020 @terrytangyuan do your have any good ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant