My setup:
1.) memgraph in a docker image locally with 500k nodes inserted
2.) I have a query with in clause in java using neo4j driver like
MATCH (n:SomeNode) where n.compoundKey in $ids RETURN n
this query for lets say 180 ids is executing 22sec ins java but if i execute the query in the memgraph lab it takes 5ms
Is there something specific with the java driver that I need to take care of?
the java code look like this
public List<Noad> getByKeys(Collection<String> keys) {
try (Session session = driver.session()) {
Map<String, Object> params = new HashMap<>();
params.put("ids", keys);
final String query = """
MATCH (n:SomeNode)
WHERE n.compoundKey IN $ids
RETURN n
""";
Result result = session.run(query, params);
.......
}
}
Using
neo4j driver
org.neo4j.driver:neo4j-java-driver:5.13.0
Java 21
Memgraph 2.11.0 running locally in a docker
settings for the driver inside quarkus app
neo4j:
pool:
max-connection-pool-size: 50
log-leaked-sessions: true
uri: bolt://localhost:7687
For the time being, I think this is related to potentially slow session closing with Neo4j driver, not actual query execution: https://github.com/memgraph/memgraph/issues/1450