I'm going to try in my application Neo4j Manual Index on Relationship Properties in order to fix the performance issue I faced Neo4j Cypher query performance optimization
I have a few question which is not clear to me from the official Neo4j documentation:
MATCH (:Flight)-[r:DESTINATION]->(:Airport) CALL apoc.index.addRelationship(r,['taxi_time']) RETURN count(*)
The statement will create the relationship index with the same name as relationship-type, in this case DESTINATION and add the relationship by its properties to the index.
When do I need to create this relationship index? It should be done once(let's say at the application startup) or do I need to invoke this APOC function each time new
-[r:DESTINATION]->
relationship is added betweenFlight
andAirport
nodes?In case of existing
-[r:DESTINATION]->
relationship update, how to update this information in the appropriate manual index?In case of deleting some of
Flight
orAirport
node - do I need to manually find and remove appropriate-[r:DESTINATION]->
relationships from the manual index or it will be done automatically by APOC and Neo4j?In case of Spring Data Neo4j project - how to properly execute queries that contain APOC functions? For example, I want to call
apoc.index.addRelationship
in order to create the manual index for the relationship properties. Can I useorg.neo4j.ogm.session.Session.query
for this purpose?What the consistency model is used for the manual indexes - Do they use eventual consistency or strong consistency model between the index and the original data?