Same cypher query taking different time when executed through different consoles:
Executed via spring-data-neo4j: (took 8 seconds)
@Query(
"MATCH (user:User {uid:{0}})-[:FRIEND]-(friend:User)" +
"RETURN friend"
)
public List<User> getFriends(String userId);
Executed via http://localhost:7474/browser/
: (took 250 ms)
Executed via http://localhost:7474/webadmin/#/console/
: (took 18 ms)
Even though queries executed via console are very fast and taking time under acceptable range but for production I have to execute those queries from my java app and in which case the time taken by queries are totally unacceptable.
Edit:
@NodeEntity
public class User extends AbstractEntity {
@RelatedToVia(elementClass = Friendship.class, type = FRIEND, direction = BOTH)
private Set<Friendship> friendships;
...
}