简体   繁体   中英

Neo4j Cypher Query Tuning

I'd like to provide the same level of query tuning support in Neo4j that I provide for relational databases. I understand that many tuning problems are best solved through data design, but sometimes you just need to help the optimizer along. There's not much documentation about the optimizer and query tuning in Neo4j 2.2.5, so I'm hoping someone can help me answer a few questions about Cypher query tuning in Neo4j.

1) Optimizer: In a relational DBMS, one way to help the optimizer make better decisions is to update statistics. I can't find documentation about how the cost-based optimizer makes its decisions, but I would expect that it must gather some statistics about the data in order to come up with better answers than we'd get from the rule-based optimizer.

a. Is there a way to update those statistics?

b. Would I get any performance benefit from dropping and recreating indexes on a database that we've loaded and are about to make read-only?

c. Do you know of any documentation on the optimizer that might help me understand the decisions it makes?

2) Query-level Hints: I know that Cypher has the option of index hints, but in many cases it would be great if it had the equivalent of the “Force Order” query hint that's available in TSQL. Do you know whether I should hold out hope for that sort of query hint in a near-future release of Neo4j?

3) Temporary objects: In a relational DBMS, sometimes I just have to reconcile ourselves to limitations in the optimizer. In those cases, we create temporary objects to materialize a part of the data so we can simplify our queries. Is there any indication that temporary labels or some other temporary object will be available in a near-future release of Neo4j?

Thanks

You can use profile or explain and so how many db hits you have. You just have to try to keep the db hits low.

You can also use "USING INDEX n:Swedish(surname)" so you know that neo4j will be forced to use the index.

You can use PLANNER RULE or Planner cost.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM