Neo4j merge performance -



Neo4j merge performance -

i have info import engine queries api's social data, , processes neo4j

i'm using merge query create/update useractivity nodes, , relating them contact's, follows:

match (profile:socialprofile {profile_id:20})-[:`relates_to`]->(user:contact) merge (user)-[r:`user_activity`]->(activity:useractivity {useractivity_id: '20_532181000298962040'}) on create set r = {is_new: true, date_created: '2014-11-11 16:03:05'}, activity = {date: '2014-11-11 14:40:12', text: 'hi man hope well!', user: '{"identifier":289883222,"displayname":"foomanchu","profileurl":"http:\\/\\/twitter.com\\/foomanchu","photourl":"http:\\/\\/pbs.twimg.com\\/profile_images\\/474234438473353985\\/rbp-7k33_normal.png"}', to: null, to_id: null, type: 'feed', relates_to: null, num_replies: null, num_likes: null, num_retweets: 1, num_favorites: 3, is_liked: false, is_favorited: false, author_self: null, media_type: 'link', media_embed_url: "http://ow.ly/ez3dt", media_action_url: "http://ow.ly/ez3dt", remote_uid: 532181000298962040, useractivity_id: '20_532181000298962040', service: 'twitter', datetime: 1415716812, author_remote_uid: 289883222} on match set activity = {date: '2014-11-11 14:40:12', text: 'hi man hope well!', user: '{"identifier":289883222,"displayname":"foomanchu","profileurl":"http:\\/\\/twitter.com\\/foomanchu","photourl":"http:\\/\\/pbs.twimg.com\\/profile_images\\/474234438473353985\\/rbp-7k33_normal.png"}', to: null, to_id: null, type: 'feed', relates_to: null, num_replies: null, num_likes: null, num_retweets: 1, num_favorites: 3, is_liked: false, is_favorited: false, author_self: null, media_type: 'link', media_embed_url: "http://ow.ly/ez3dt", media_action_url: "http://ow.ly/ez3dt", remote_uid: 532181000298962040, useractivity_id: '20_532181000298962040', service: 'twitter', datetime: 1415716812, author_remote_uid: 289883222}

some notes: - we're talking db 500k nodes, it's small. - takes 1,000ms on cloud server digital ocean (8 gb ram, 4 cores) - on 1+year old laptop, in vm 1.5 gb ram, takes 350ms (still slow not slow). -i'm not sure why discrepancy since other server (in theory) far more powerful. -in both environments databases identical (zipped info folder , copied on prior tests), yet there important discrepancies in speed.

i'm wondering couple of things: 1. there can optimize queries? have indexes on profile_id , useractivity_id 2. practical hardware/jvm/neo4j performance suggestions? i'm struggling neo4j documentation on performance tuning guide.

thanks in advance.

yes there couple of things can :

what indexing strategy ? have socialprofile-profile_id property indexed ?

use query parameters, cypher query can cached independtly of passed parameters

for first match, can match first socialprofile alone, using label+indexed property profile_id , match pattern user :

match (profile:socialprofile {profile_id:20}) profile match (profile)-[:relates_to]->(user:contact) ...

chris

neo4j

Comments

Popular posts from this blog

javascript - THREE.js reposition vertices for RingGeometry -

javascript - I need to update the text of a paragraph by inline edit -

assembly - What is the addressing mode for ld, add, and rjmp instructions? -