1) You mean loading, weighting, sorting 1.5M movies? Doesn't sound to bad
to me for a database that was not made for global aggregation queries.
Is that the first run or a subsequent one?

2) create an index or constraint on :Director(name)
Don't use a regexp but an exact string value too look it up.

MATCH (director:Director)-[:Directed]->(movie:Movie)
WHERE  director.name = 'DIRECTOR_NAME'
WITH movie, toInt(movie.ratings_count) * toInt(movie.reviews_count) *
toInt(movie.rating) AS total_weight
RETURN movie, total_weight
ORDER BY total_weight DESC, movie.rating DESC
LIMIT 10



On Mon, Jul 7, 2014 at 12:57 PM, Bhuwan Arora <[email protected]>
wrote:

> I have an embedded neo4j server with ruby on rails.
>
> These are the configurations:
>
> neostore.nodestore.db.mapped_memory=25M
> neostore.relationshipstore.db.mapped_memory=240M
> neostore.propertystore.db.mapped_memory=230M
> neostore.propertystore.db.strings.mapped_memory=1200M
> neostore.propertystore.db.arrays.mapped_memory=130M
>
> wrapper.java.initmemory=1024
> wrapper.java.maxmemory=2048
>
> There are around 15lakh movie nodes. The below query is taking around
> 5secs to execute.
>
> MATCH (movie:Movie)
> WITH movie, toInt(movie.reviews_count) + toInt(movie.ratings_count) AS weight
> RETURN movie, weight as weight
> ORDER BY weight DESC
> SKIP skip_count
> LIMIT 10
>
> Here the skip_count varies as the user scroll for the results.
>
> and this another query which aims to get the movies from a particular
> director takes around 9secs
>
> MATCH (movie:Movie) , (director:Director)-[:Directed]->(movie)
> WHERE  director.name =~ '(?i)DIRECTOR_NAME'
> WITH movie, toInt(movie.ratings_count) * toInt(movie.reviews_count) * 
> toInt(movie.rating) AS total_weight
> RETURN movie, total_weight
> ORDER BY total_weight DESC, movie.rating DESC
> LIMIT 10
>
> How can I reduce the query execution time?
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to