What you are doing is not a graph query it is just iterating over all records and sorting them.
That means it has to pull everything in memory from disk and then sort it there into your result window. In the second query it does this from the caches but still has to sort it all. The indexes don't help here they are just for looking up individual nodes. In theory it is parallelizable but in reality it is probably too much effort. If you really need that information, you can connect the top-n calls in your db to a node and then whenever you update total-calls you can reconnect the new top ones. Or use an index on a certain flag to index only the top-n nodes and store the current lowest total call # somewhere. But if that's your main use-case you should probably not use a graph database. Michael Am 08.01.2014 um 16:05 schrieb pulkit sogani <[email protected]>: > Hi, > I have inserted 2 lakh records in neo4j database and firing query and query > is taking too much time. observations are as below :- > > Graph database details :- > > My graph database nodes are having two properties one is mobile number and > another is Total Calls Received. Mobile Number and Total Calls Received both > properties are indexed. > > Query 1 :- For finding all nodes having top 20 Total Calls Received nodes in > my graph database :- > > START r=node(*) RETURN r.`Mobile Number`,r.`Total Calls Received` Order By > r.`Total Calls Received` desc Limit 20 > > Result :- > > This query is taking around 100 seconds in fresh execution consuming disk and > CPU both. When i execute it again it takes around 40 seconds and consuming > only CPU. > > I want to ask :- > > 1) Why this query is consuming CPU ? > 2) Query is using only 1 core of CPU, Is there any way to tell neo4j to use > multiple cores in query execution ? or is there any way to achieve > parallelism in query execution ? > > Thanks & Regards, > Pulkit Sogani > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
