Showing results for 
Search instead for 
Did you mean: 

Query Runs Forever When Using Python Neo4j Driver But Runs in a Finite Time on Neo4j Browser

Hello everyone, this is my first post here and I'm kind of new to Neo4j.

I'm trying to get some data from a remotely neo4j database that is running on a single computer. When a run the query on the Neo4j browser it takes approximately 351s to compute, but when I try to run the same query with python using the neo4j driver the query never ends.

Here is the query:

Basically I what to find the users (u2) that tweeted some user (u) in the 'btc' community with the constrain that (u2) are not in the 'btc' community.

match (u:User)-[:IN]->(c:Community{name:'btc'})
where u.final_stock_pagerank > 100

match (u)-[:TWEETED]->(:Tweet)<-[:RETWEETED]-(t:Tweet)<-[:TWEETED]-(u2:User)
where t.timestamp > timestamp() - 2*30*24*3600*1000
and u2.final_stock_pagerank > 100
and not (u2)-[:IN]->(c)

return distinct(u2.username) limit 500

If I change the limit to 350 ( return distinct(u2.username) limit 350) for example, the query runs fine on 180s, but if I increase the limit values it reaches some threshold and the process just runs forever.

My hypotheses is: If the process takes more than some time X to complete, than something wrong happens and the process never ends.

My configuration is the following:

  • neo4j driver version: '1.7.6'
  • neo4j : 3.5.15
  • I'm using bolt connection (but the problem is the same with http connection )

I also tried to use the py2neo package, but the same problem happens