neo4j-sh (?)$ START n=node(*) WHERE HAS (n.code) AND n.code = 'IN05_lvl1' RETURN n.code;+-------------+| n.code |+-------------+| "IN05_lvl1" |+-------------+1 row102405 msneo4j-sh (?)$ MATCH (ndt:NLRS_DATA_TYPE) WHERE ndt.code = 'IN05_lvl1' RETURN ndt.code; +----------+| ndt.code |+----------++----------+0 row31 msneo4j-sh (?)$ MATCH (ndt:NLRS_DATA_TYPE { code : 'IN05_lvl1' }) RETURN ndt.code; +----------+| ndt.code |+----------++----------+0 row20 msneo4j-sh (?)$ MATCH (ndt:NRLS_DATA_TYPE) RETURN ndt.code; +-------------------+| ndt.code |+-------------------+| "RP07" || "IN07" || "Age_at_Incident" || "ST01_LVL1" || "PD09" || "PD05_lvl1" || "IN05_lvl1" || "IN03_lvl1" || "IN07_01MMYY" || "PD11" || "IN02_A_01" || "IN01" || "PD02" |+-------------------+13 rows113 msneo4j-sh (?)$ MATCH (ndt:NLRS_DATA_TYPE { code : "IN05_lvl1" }) RETURN ndt.code;--
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 neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
neo4j-sh (?)$ MATCH (ndt:NRLS_DATA_TYPE { code : 'IN05_lvl1' })> MERGE (ic:INCIDENT_CATEGORY { category_level_01 : 'FOOBAR' })-[r:HAS_NRLS_DATA_TYPE]->(ndt)> RETURN ic, r;+-----------------------------------------------------------------------------+| ic | r |+-----------------------------------------------------------------------------+| Node[2121668]{category_level_01:"FOOBAR"} | :HAS_NRLS_DATA_TYPE[16880045]{} |+-----------------------------------------------------------------------------+1 rowNodes created: 1Relationships created: 1Properties set: 1neo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() RETURN DISTINCT labels(n), type(r), count(*) ORDER BY labels(n)[0], type(r);+-----------------------------------------------------------------------+| labels(n) | type(r) | count(*) |+-----------------------------------------------------------------------+| ["DEGREE_OF_HARM"] | "HAS_INCIDENT_DEGREE_OF_HARM" | 2120424 || ["DEGREE_OF_HARM"] | "HAS_NRLS_DATA_TYPE" | 7 || ["INCIDENT"] | "HAS_INCIDENT_CATEGORY" | 2120457 || ["INCIDENT"] | "HAS_INCIDENT_DEGREE_OF_HARM" | 2120424 || ["INCIDENT"] | "HAS_INCIDENT_PATIENT" | 2120432 || ["INCIDENT"] | "HAS_INCIDENT_REPORTER" | 2120442 || ["INCIDENT"] | "HAS_INCIDENT_SPECIALITY" | 2120450 || ["INCIDENT"] | "HAS_NRLS_DATA_TYPE" | 2120486 || ["INCIDENT"] | "IS_NHS_TRUST_INCIDENT" | 2120483 || ["INCIDENT"] | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2114664 || ["INCIDENT_CATEGORY"] | "HAS_INCIDENT_CATEGORY" | 2120457 || ["INCIDENT_CATEGORY"] | "HAS_NRLS_DATA_TYPE" | 16 || ["INCIDENT_REPORTER"] | "HAS_INCIDENT_REPORTER" | 2120442 || ["INCIDENT_REPORTER"] | "HAS_NRLS_DATA_TYPE" | 12 || ["INCIDENT_SPECIALITY"] | "HAS_INCIDENT_SPECIALITY" | 2120450 || ["INCIDENT_SPECIALITY"] | "HAS_NRLS_DATA_TYPE" | 17 || ["NHS_TRUST"] | "HAS_NHS_TRUST_LOCATION" | 480 || ["NHS_TRUST"] | "HAS_NRLS_DATA_TYPE" | 63 || ["NHS_TRUST"] | "IS_NHS_TRUST_INCIDENT" | 2120483 || ["NHS_TRUST_LOCATION"] | "HAS_NHS_TRUST_LOCATION" | 480 || ["NHS_TRUST_LOCATION"] | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2114664 || ["NRLS_DATA_TYPE"] | "HAS_NRLS_DATA_TYPE" | 2123426 || ["PATIENT"] | "HAS_INCIDENT_PATIENT" | 2120432 || ["PATIENT"] | "HAS_NRLS_DATA_TYPE" | 2825 |+-----------------------------------------------------------------------+24 rows247418 mscache_type=hpcnode_cache_array_fraction=6relationship_cache_array_fraction=7#node_cache_size=1024relationship_cache_size=2G[root@miyu graph.db]# ls -l neostore* | awk '{printf("%10s %s\n", $5, $9)}' 63 neostore 55 neostore.labeltokenstore.db 456 neostore.labeltokenstore.db.names 29850422 neostore.nodestore.db 68 neostore.nodestore.db.labels 177676780 neostore.propertystore.db 128 neostore.propertystore.db.arrays 162 neostore.propertystore.db.index 722 neostore.propertystore.db.index.keys 679805312 neostore.propertystore.db.strings 560433951 neostore.relationshipstore.db 45 neostore.relationshiptypestore.db 380 neostore.relationshiptypestore.db.names 1600 neostore.schemastore.dbneostore.nodestore.db.mapped_memory=50Mneostore.relationshipstore.db.mapped_memory=756Mneostore.propertystore.db.mapped_memory=300Mneostore.propertystore.db.strings.mapped_memory=756Mneostore.propertystore.db.arrays.mapped_memory=50M# Initial Java Heap Size (in MB)wrapper.java.initmemory=2048
# Maximum Java Heap Size (in MB)wrapper.java.maxmemory=5632neo4j-sh (?)$ schemaWelcome to the Neo4j Shell! Enter 'help' for a list of commands[Reconnected to server]Indexes ON :DEGREE_OF_HARM(degree_of_harm) ONLINE (for uniqueness constraint) ON :INCIDENT(incident_description) ONLINE ON :INCIDENT(incident_timestamp) ONLINE ON :INCIDENT(incident_id) ONLINE (for uniqueness constraint) ON :INCIDENT_CATEGORY(category_level_01) ONLINE (for uniqueness constraint) ON :INCIDENT_REPORTER(reporter_level_01) ONLINE (for uniqueness constraint) ON :INCIDENT_SPECIALITY(speciality_level_01) ONLINE (for uniqueness constraint) ON :NHS_TRUST(name) ONLINE (for uniqueness constraint) ON :NHS_TRUST_LOCATION(location_level_01) ONLINE (for uniqueness constraint) ON :NRLS_DATA_TYPE(code) ONLINE (for uniqueness constraint) ON :PATIENT(patient_age) ONLINE ON :PATIENT(patient_sex) ONLINE ON :PATIENT(patient_ethnicity) ONLINE
Constraints ON (nrls_data_type:NRLS_DATA_TYPE) ASSERT nrls_data_type.code IS UNIQUE ON (nhs_trust:NHS_TRUST) ASSERT nhs_trust.name IS UNIQUE ON (degree_of_harm:DEGREE_OF_HARM) ASSERT degree_of_harm.degree_of_harm IS UNIQUE ON (incident:INCIDENT) ASSERT incident.incident_id IS UNIQUE ON (nhs_trust_location:NHS_TRUST_LOCATION) ASSERT nhs_trust_location.location_level_01 IS UNIQUE ON (incident_reporter:INCIDENT_REPORTER) ASSERT incident_reporter.reporter_level_01 IS UNIQUE ON (incident_category:INCIDENT_CATEGORY) ASSERT incident_category.category_level_01 IS UNIQUE ON (incident_speciality:INCIDENT_SPECIALITY) ASSERT incident_speciality.speciality_level_01 IS UNIQUE(The ../cypher endpoint is used by default, and ../transaction within a txn marked as above)Ice-9, you can use the transaction support in the latest Neo4p (>0.2220) :REST::Neo4p->begin_work;...queries and stuffif ($something_bad_happened) {REST::Neo4p->commit;
Hi Michael,I've posted the newest code here: http://pastebin.com/7PikkZRPI've switched all of my CREATE UNIQUE statements to MERGE. I'm still convinced though that the inserts are under-performing. It's taking about 5 minutes for all of the statements in that code to execute 500 times. Overtime this gap grows to around 8 even up to 12 minutes. My biggest bottleneck seems to be the incident nodes and their relationships:neo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() RETURN DISTINCT labels(n), type(r), count(*) ORDER BY labels(n)[0], type(r);+-----------------------------------------------------------------------+| labels(n) | type(r) | count(*) |+-----------------------------------------------------------------------+| ["DEGREE_OF_HARM"] | "HAS_INCIDENT_DEGREE_OF_HARM" | 2120424 || ["DEGREE_OF_HARM"] | "HAS_NRLS_DATA_TYPE" | 7 |
Total time in transaction: 1.804445
Per query time (including read callback):
Incident merge: 0.018740Incident HAS_NRLS_DATA_TYPE: 0.852701Incident IS_NHS_TRUST_INCIDENT: 0.023515Incident IS_NHS_TRUST_LOCATION_INCIDENT: 0.754672Incident Category merge + HAS_NRLS_DATA_TYPE: 0.014473Incident HAS_INCIDENT_CATEGORY: 0.012777Incident Speciality merge + HAS_NRLS_DATA_TYPE: 0.012035Incident HAS_INCIDENT_SPECIALITY: 0.010719Incident Reporter merge + HAS_NRLS_DATA_TYPE: 0.011301Incident HAS_INCIDENT_REPORTER: 0.010741Incident Patient merge + HAS_NRLS_DATA_TYPE: 0.021814Incident HAS_INCIDENT_PATIENT: 0.011810Incident DOH merge + HAS_NRLS_DATA_TYPE: 0.011132Incident HAS_DEGREE_OF_HARM: 0.010414neo4j-sh (?)$ MATCH (i:INCIDENT)-[r:HAS_NRLS_DATA_TYPE]->(ndt:NRLS_DATA_TYPE) USING SCAN ndt:NRLS_DATA_TYPE RETURN type(r), count(i.incident_id);+---------------------------------------------+| type(r) | count(i.incident_id) |+---------------------------------------------+| "HAS_NRLS_DATA_TYPE" | 2129522 |+---------------------------------------------+1 row62598 msneo4j-sh (?)$ MATCH (i:INCIDENT)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl:NHS_TRUST_LOCATION) USING SCAN ntl:NHS_TRUST_LOCATION RETURN type(r), count(i.incident_id);+---------------------------------------------------------+| type(r) | count(i.incident_id) |+---------------------------------------------------------+| "IS_NHS_TRUST_LOCATION_INCIDENT" | 2123700 |+---------------------------------------------------------+1 row14950 msneo4j-sh (?)$ 
~ icenine
<transaction_trace.txt>
1 rowNodes created: 1Relationships created: 1Properties set: 1Labels added: 148 msneo4j-sh (?)$ MERGE (ntl:NHS_TRUST_LOCATION { location_level_01 : 'General / acute hospital' })> RETURN ntl.location_level_01> ;+----------------------------+| ntl.location_level_01 |+----------------------------+| "General / acute hospital" |+----------------------------+1 row27 msneo4j-sh (?)$ MATCH (nt:NHS_TRUST { name : 'masked_nhs_trust'}), > (ntl:NHS_TRUST_LOCATION { location_level_01 : 'General / acute hospital'})> MERGE (nt)-[hntl:HAS_NHS_TRUST_LOCATION]->(ntl) RETURN hntl> ;+-------------------------------------+| hntl |+-------------------------------------+| :HAS_NHS_TRUST_LOCATION[17036432]{} |+-------------------------------------+1 rowRelationships created: 11211 msneo4j-sh (?)$ MERGE (i:INCIDENT { incident_id : 'masked_incident_id' })> ON CREATE SET i.incident_timestamp = '2005-03-28T00:00:00',> i.incident_description = 'masked_incident_description'> RETURN i.incident_id;+---------------+| i.incident_id |+---------------+| "xxxxxx" |+---------------+1 rowNodes created: 1Properties set: 3Labels added: 140 msneo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id'}), > (ndt:NRLS_DATA_TYPE { code : 'IN07'}) > MERGE (i)-[hndt:HAS_NRLS_DATA_TYPE]->(ndt)> RETURN hndt;+---------------------------------+| hndt |+---------------------------------+| :HAS_NRLS_DATA_TYPE[17036433]{} |+---------------------------------+1 rowRelationships created: 13782 msneo4j-sh (?)$ MATCH (n:NHS_TRUST { name : 'masked_nhs_trust'}), > (i:INCIDENT { incident_id : 'masked_incident_description'})> MERGE (i)-[r:IS_NHS_TRUST_INCIDENT]->(n) > RETURN r;+------------------------------------+| r |+------------------------------------+| :IS_NHS_TRUST_INCIDENT[17036434]{} |+------------------------------------+1 rowRelationships created: 181 msneo4j-sh (?)$ MATCH (ntl:NHS_TRUST_LOCATION { location_level_01 : 'General / acute hospital'}), > (i:INCIDENT { incident_id : 'masked_incident_id'})> MERGE (i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl) > RETURN r;+---------------------------------------------+| r |+---------------------------------------------+| :IS_NHS_TRUST_LOCATION_INCIDENT[17036435]{} |+---------------------------------------------+1 rowRelationships created: 11973 msneo4j-sh (?)$ MATCH (ndt:NRLS_DATA_TYPE { code : 'IN05_lvl1'})> MERGE (ic:INCIDENT_CATEGORY { category_level_01 : 'Implementation of care and ongoing monitoring / review' > })-[r:HAS_NRLS_DATA_TYPE]->(ndt)> RETURN ic.category_level_01;+----------------------------------------------------------+| ic.category_level_01 |+----------------------------------------------------------+| "Implementation of care and ongoing monitoring / review" |+----------------------------------------------------------+1 row54 msneo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id'})> MERGE (i)-[r:HAS_INCIDENT_CATEGORY]->> (ic:INCIDENT_CATEGORY { category_level_01 : 'Implementation of care and ongoing monitoring / review'})> RETURN r;CypherExecutionException: Node 386 already exists with label INCIDENT_CATEGORY and property "category_level_01"=[Implementation of care and ongoing monitoring / review]MATCH (i:INCIDENT { incident_id : { incident_id }}),(ic:INCIDENT_CATEGORY { category_level_01 : { category_level_01 }})MERGE (i)-[r:HAS_INCIDENT_CATEGORY]->(ic)RETURN rneo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id'}),> (ic:INCIDENT_CATEGORY { category_level_01 : 'Implementation of care and ongoing monitoring / review'})> MERGE (i)-[r:HAS_INCIDENT_CATEGORY]->(ic)> RETURN r;+------------------------------------+| r |+------------------------------------+| :HAS_INCIDENT_CATEGORY[17036442]{} |+------------------------------------+1 rowRelationships created: 1411 msActually sorry, I'm ignoring the obvious here, the incident category would have already been created in the previous statement so in all reality I could use:
neo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id'}),> (ic:INCIDENT_CATEGORY { category_level_01 : 'Implementation of care and ongoing monitoring / review'})> MERGE (i)-[r:HAS_INCIDENT_CATEGORY]->(ic)> RETURN r;+------------------------------------+| r |+------------------------------------+| :HAS_INCIDENT_CATEGORY[17036442]{} |+------------------------------------+
1 rowRelationships created: 1411 ms
MATCH (i:INCIDENT { incident_id : { incident_id }}),(ndt:NRLS_DATA_TYPE { code : { code }})MERGE (i)-[hndt:HAS_NRLS_DATA_TYPE]->(ndt)RETURN hndt
MATCH (i:INCIDENT { incident_id : { incident_id }}),(ndt:NRLS_DATA_TYPE { code : { code }})
RETURN i,ndt
<transaction_trace.txt>
Connecting to Neo4j : http://localhost:7474 Thu Jan 2 20:43:00 2014Done connecting to Neo4j : http://localhost:7474 Thu Jan 2 20:43:00 2014Creating REST::Neo4p::Query objects Thu Jan 2 20:43:00 2014Done creating REST::Neo4p::Query objects Thu Jan 2 20:43:00 2014Beginning processing loop Thu Jan 2 20:43:00 2014Processed 100 rows. Thu Jan 2 20:43:58 2014Processed 200 rows. Thu Jan 2 20:44:56 2014Processed 300 rows. Thu Jan 2 20:45:55 2014Processed 400 rows. Thu Jan 2 20:46:53 2014
... truncated ...
Processed 11700 rows. Thu Jan 2 23:10:58 2014Processed 11800 rows. Thu Jan 2 23:12:15 2014Processed 11900 rows. Thu Jan 2 23:13:29 2014Processed 12000 rows. Thu Jan 2 23:14:49 2014Processed 12100 rows. Thu Jan 2 23:16:13 2014Processed 12200 rows. Thu Jan 2 23:17:33 2014Completed processing loop Thu Jan 2 23:17:39 2014neo4j-sh (?)$ START n=node(*) RETURN labels(n)[0] AS node_labels, count(*) AS node_count ORDER BY node_labels;+------------------------------------+| node_labels | node_count |+------------------------------------+| "DEGREE_OF_HARM" | 7 || "INCIDENT" | 2143501 || "INCIDENT_CATEGORY" | 16 || "INCIDENT_REPORTER" | 12 || "INCIDENT_SPECIALITY" | 17 || "NHS_TRUST" | 67 || "NHS_TRUST_LOCATION" | 12 || "NRLS_DATA_TYPE" | 13 || "PATIENT" | 2825 || <null> | 1 |+------------------------------------+10 rows25754 msneo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() RETURN DISTINCT labels(n)[0] AS node_labels, type(r) AS relationship, count(*) AS rel_per_node_count ORDER BY node_labels;+-------------------------------------------------------------------------------+| node_labels | relationship | rel_per_node_count |+-------------------------------------------------------------------------------+| "DEGREE_OF_HARM" | "HAS_INCIDENT_DEGREE_OF_HARM" | 2143422 || "DEGREE_OF_HARM" | "HAS_NRLS_DATA_TYPE" | 7 || "INCIDENT" | "HAS_INCIDENT_DEGREE_OF_HARM" | 2143422 || "INCIDENT" | "HAS_NRLS_DATA_TYPE" | 2143490 || "INCIDENT" | "HAS_INCIDENT_SPECIALITY" | 2143448 || "INCIDENT" | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2137662 || "INCIDENT" | "HAS_INCIDENT_CATEGORY" | 2143455 || "INCIDENT" | "IS_NHS_TRUST_INCIDENT" | 2143481 || "INCIDENT" | "HAS_INCIDENT_REPORTER" | 2143440 || "INCIDENT" | "HAS_INCIDENT_PATIENT" | 2143430 || "INCIDENT_CATEGORY" | "HAS_NRLS_DATA_TYPE" | 16 || "INCIDENT_CATEGORY" | "HAS_INCIDENT_CATEGORY" | 2143455 || "INCIDENT_REPORTER" | "HAS_NRLS_DATA_TYPE" | 12 || "INCIDENT_REPORTER" | "HAS_INCIDENT_REPORTER" | 2143440 || "INCIDENT_SPECIALITY" | "HAS_NRLS_DATA_TYPE" | 17 || "INCIDENT_SPECIALITY" | "HAS_INCIDENT_SPECIALITY" | 2143448 || "NHS_TRUST" | "HAS_NHS_TRUST_LOCATION" | 498 || "NHS_TRUST" | "IS_NHS_TRUST_INCIDENT" | 2143481 || "NHS_TRUST" | "HAS_NRLS_DATA_TYPE" | 67 || "NHS_TRUST_LOCATION" | "HAS_NHS_TRUST_LOCATION" | 498 || "NHS_TRUST_LOCATION" | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2137662 || "NRLS_DATA_TYPE" | "HAS_NRLS_DATA_TYPE" | 2146434 || "PATIENT" | "HAS_INCIDENT_PATIENT" | 2143430 || "PATIENT" | "HAS_NRLS_DATA_TYPE" | 2825 |+-------------------------------------------------------------------------------+24 rows366826 msneo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id' }),> (ndt:NRLS_DATA_TYPE { code : 'IN07' })> MERGE (i)-[hndt:HAS_NRLS_DATA_TYPE]->(ndt)> RETURN hndt;+---------------------------------+| hndt |+---------------------------------+| :HAS_NRLS_DATA_TYPE[17050540]{} |+---------------------------------+1 row2320 ms
neo4j-sh (?)$ MATCH (i:INCIDENT { incident_id : 'masked_incident_id' }),> (ndt:NRLS_DATA_TYPE { code : 'IN07' })> RETURN i, ndt;+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| i | ndt |+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Node[2143024]{incident_id:"masked_incident_id",incident_timestamp:"2005-02-05T12:00:00",incident_description:"masked_incident_description"} | Node[2]{code:"IN07",description:"Incident description",input_type:"free-text"} |+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+1 row124 msneo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() RETURN labels(n)[0] AS node_labels, type(r) AS relationship, count(*) AS rel_per_node_count ORDER BY rel_per_node_count; +-------------------------------------------------------------------------------+ | node_labels | relationship | rel_per_node_count |+-------------------------------------------------------------------------------+| "DEGREE_OF_HARM" | "HAS_NRLS_DATA_TYPE" | 7 || "INCIDENT_REPORTER" | "HAS_NRLS_DATA_TYPE" | 12 || "INCIDENT_SPECIALITY" | "HAS_NRLS_DATA_TYPE" | 17 || "INCIDENT_CATEGORY" | "HAS_NRLS_DATA_TYPE" | 17 || "NHS_TRUST" | "HAS_NRLS_DATA_TYPE" | 74 || "NHS_TRUST" | "HAS_NHS_TRUST_LOCATION" | 580 || "NHS_TRUST_LOCATION" | "HAS_NHS_TRUST_LOCATION" | 580 || "PATIENT" | "HAS_NRLS_DATA_TYPE" | 2913 || "INCIDENT" | "HAS_INCIDENT_DEGREE_OF_HARM" | 2565754 || "INCIDENT" | "HAS_INCIDENT_PATIENT" | 2565754 || "INCIDENT" | "HAS_INCIDENT_SPECIALITY" | 2565755 || "INCIDENT" | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2565755 || "INCIDENT" | "HAS_INCIDENT_CATEGORY" | 2565755 || "INCIDENT" | "IS_NHS_TRUST_INCIDENT" | 2565755 || "INCIDENT" | "HAS_INCIDENT_REPORTER" | 2565755 || "INCIDENT" | "HAS_NRLS_DATA_TYPE" | 2565756 || "INCIDENT_REPORTER" | "HAS_INCIDENT_REPORTER" | 2565849 || "INCIDENT_SPECIALITY" | "HAS_INCIDENT_SPECIALITY" | 2565855 || "INCIDENT_CATEGORY" | "HAS_INCIDENT_CATEGORY" | 2565862 || "DEGREE_OF_HARM" | "HAS_INCIDENT_DEGREE_OF_HARM" | 2565872 || "PATIENT" | "HAS_INCIDENT_PATIENT" | 2565927 || "NHS_TRUST" | "IS_NHS_TRUST_INCIDENT" | 2566029 || "NHS_TRUST_LOCATION" | "IS_NHS_TRUST_LOCATION_INCIDENT" | 2566062 || "NRLS_DATA_TYPE" | "HAS_NRLS_DATA_TYPE" | 2568825 |+-------------------------------------------------------------------------------+24 rows507473 msneo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() WITH labels(n)[0] AS node_labels, type(r) AS relationship, count(*) AS rel_per_node_count RETURN min(rel_per_node_count), max(rel_per_node_count), avg(rel_per_node_count);+-----------------------------------------------------------------------------+| min(rel_per_node_count) | max(rel_per_node_count) | avg(rel_per_node_count) |+-----------------------------------------------------------------------------+| 7 | 2569478 | 1711292.1666666667 |+-----------------------------------------------------------------------------+1 row491720 msneo4j-sh (?)$ START n=node(*) RETURN labels(n)[0] AS node_labels, count(*) ORDER BY node_labels; +----------------------------------+ | node_labels | count(*) |+----------------------------------+| "DEGREE_OF_HARM" | 7 || "INCIDENT" | 2567079 || "INCIDENT_CATEGORY" | 17 || "INCIDENT_REPORTER" | 12 || "INCIDENT_SPECIALITY" | 17 || "NHS_TRUST" | 74 || "NHS_TRUST_LOCATION" | 12 || "NRLS_DATA_TYPE" | 13 || "PATIENT" | 2913 || <null> | 1 |+----------------------------------+10 rows19573 ms- MATCH (i:INCIDENT), (ndt:NRLS_DATA_TYPE)
- WHERE i.incident_id = { incident_id }
- AND ndt.code = { code }
- CREATE UNIQUE
- (i)-[hndt:HAS_NRLS_DATA_TYPE]->ndt
- RETURN hndt
- MATCH (ndt:NRLS_DATA_TYPE), (i:INCIDENT)
- USING INDEX ndt:NRLS_DATA_TYPE(code)
- USING INDEX i:INCIDENT(incident_id)
- WHERE i.incident_id = { incident_id }
- AND ndt.code = { code }
- CREATE UNIQUE
- (i)-[hndt:HAS_NRLS_DATA_TYPE]->(ndt)
- RETURN hndt
| ["INCIDENT"] =A
Enter code neo4j-sh (?)$ START n=node(*) WHERE NOT (id(n) = 0) RETURN labels(n)[0], count(*);+----------------------------------+| labels(n)[0] | count(*) |+----------------------------------+| "INCIDENT_REPORTER" | 12 || "INCIDENT_CATEGORY" | 17 || "PATIENT" | 3020 || "NRLS_DATA_TYPE" | 13 || "INCIDENT" | 3061831 || "INCIDENT_SPECIALITY" | 17 || "NHS_TRUST_LOCATION" | 12 || "DEGREE_OF_HARM" | 7 || "NHS_TRUST" | 89 |+----------------------------------+9 rows25399 msneo4j-sh (?)$ START n=node(*) MATCH (n)-[r]-() WITH labels(n)[0] AS node_labels, type(r) AS relationship, count(*) AS rel_per_node_count RETURN min(rel_per_node_count), max(rel_per_node_count), avg(rel_per_node_count);+-----------------------------------------------------------------------------+| min(rel_per_node_count) | max(rel_per_node_count) | avg(rel_per_node_count) |+-----------------------------------------------------------------------------+| 7 | 3064993 | 2041541.0 |+-----------------------------------------------------------------------------+1 row580615 ms[jsymons@larva conf]$ egrep '^[^#].*(mapped|cache)' neo4j.propertiesneostore.nodestore.db.mapped_memory=50Mneostore.relationshipstore.db.mapped_memory=756Mneostore.propertystore.db.mapped_memory=300Mneostore.propertystore.db.strings.mapped_memory=1024Mneostore.propertystore.db.arrays.mapped_memory=50Mnode_cache_array_fraction=6relationship_cache_array_fraction=7relationship_cache_size=2G[jsymons@larva conf]$ ls -l ../data/graph.db/neostore*-rw-r--r--. 1 jsymons saichonstaff 63 Jan 10 12:49 ../data/graph.db/neostore-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.id-rw-r--r--. 1 jsymons saichonstaff 55 Jan 10 10:21 ../data/graph.db/neostore.labeltokenstore.db-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.labeltokenstore.db.id-rw-r--r--. 1 jsymons saichonstaff 456 Jan 10 10:21 ../data/graph.db/neostore.labeltokenstore.db.names-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.labeltokenstore.db.names.id-rw-r--r--. 1 jsymons saichonstaff 43138368 Jan 10 12:49 ../data/graph.db/neostore.nodestore.db-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.nodestore.db.id-rw-r--r--. 1 jsymons saichonstaff 68 Jan 10 10:21 ../data/graph.db/neostore.nodestore.db.labels-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.nodestore.db.labels.id-rw-r--r--. 1 jsymons saichonstaff 256888780 Jan 10 12:49 ../data/graph.db/neostore.propertystore.db-rw-r--r--. 1 jsymons saichonstaff 128 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.arrays-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.arrays.id-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.id-rw-r--r--. 1 jsymons saichonstaff 162 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.index-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.index.id-rw-r--r--. 1 jsymons saichonstaff 722 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.index.keys-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.index.keys.id-rw-r--r--. 1 jsymons saichonstaff 995533184 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.strings-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.propertystore.db.strings.id-rw-r--r--. 1 jsymons saichonstaff 809811255 Jan 10 12:49 ../data/graph.db/neostore.relationshipstore.db-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.relationshipstore.db.id-rw-r--r--. 1 jsymons saichonstaff 50 Jan 10 10:21 ../data/graph.db/neostore.relationshiptypestore.db-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.relationshiptypestore.db.id-rw-r--r--. 1 jsymons saichonstaff 418 Jan 10 10:21 ../data/graph.db/neostore.relationshiptypestore.db.names-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.relationshiptypestore.db.names.id-rw-r--r--. 1 jsymons saichonstaff 1600 Jan 10 10:21 ../data/graph.db/neostore.schemastore.db-rw-r--r--. 1 jsymons saichonstaff 9 Jan 10 10:21 ../data/graph.db/neostore.schemastore.db.id[jsymons@larva conf]$ grep 'wrapper.java.*memory' neo4j-wrapper.conf wrapper.java.initmemory=2048wrapper.java.maxmemory=5632[jsymons@larva conf]$ free -m total used free shared buffers cachedMem: 7873 7736 136 0 133 2236-/+ buffers/cache: 5366 2506Swap: 10063 22 10041MERGE (i:INCIDENT { incident_id : '99999999' })ON CREATE SET i.incident_timestamp = 'test',i.incident_description = 'test'RETURN i.incident_id
neo4j-sh (?)$ MERGE (i:INCIDENT { incident_id : '99999999' })> ON CREATE SET i.incident_timestamp = 'test',> i.incident_description = 'test'> RETURN i.incident_id;+---------------+| i.incident_id |+---------------+| "99999999" |+---------------+1 rowNodes created: 1Properties set: 3Labels added: 1107 ms
MATCH (ntl:NHS_TRUST_LOCATION { location_level_01 : 'General / acute hospital' }),(i:INCIDENT { incident_id : '99999999' })MERGE (i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)RETURN r
neo4j-sh (?)$ MATCH (ntl:NHS_TRUST_LOCATION { location_level_01 : 'General / acute hospital' }),> (i:INCIDENT { incident_id : '99999999' })> MERGE (i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)> RETURN r;+---------------------------------------------+| r |+---------------------------------------------+| :IS_NHS_TRUST_LOCATION_INCIDENT[24515883]{} |+---------------------------------------------+1 rowRelationships created: 122412 ms
MATCH (i:INCIDENT)-[r]-()USING INDEX i:INCIDENT(incident_id)WHERE i.incident_id = '99999999' DELETE i, r
neo4j-sh (?)$ MATCH (i:INCIDENT)-[r]-()> USING INDEX i:INCIDENT(incident_id)> WHERE i.incident_id = '99999999' DELETE i, r;+-------------------+| No data returned. |+-------------------+Nodes deleted: 1Relationships deleted: 172 msMERGE (i:INCIDENT { incident_id : '00000000' })ON CREATE SET i.incident_timestamp = 'test',i.incident_description = 'test'RETURN i.incident_id
neo4j-sh (?)$ MERGE (i:INCIDENT { incident_id : '00000000' })> ON CREATE SET i.incident_timestamp = 'test',> i.incident_description = 'test'> RETURN i.incident_id;+---------------+| i.incident_id |+---------------+| "00000000" |+---------------+1 rowNodes created: 1Properties set: 3Labels added: 179 ms
MATCH (ntl:NHS_TRUST_LOCATION), (i:INCIDENT)WHERE ntl.location_level_01 = 'General / acute hospital'AND i.incident_id = '00000000' CREATE UNIQUE(i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)RETURN r
neo4j-sh (?)$ MATCH (ntl:NHS_TRUST_LOCATION), (i:INCIDENT)> WHERE ntl.location_level_01 = 'General / acute hospital'> AND i.incident_id = '00000000' > CREATE UNIQUE> (i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)> RETURN r;+---------------------------------------------+| r |+---------------------------------------------+| :IS_NHS_TRUST_LOCATION_INCIDENT[24515886]{} |+---------------------------------------------+1 rowRelationships created: 1110 ms
MATCH (i:INCIDENT)-[r]-()USING INDEX i:INCIDENT(incident_id)WHERE i.incident_id = '00000000' DELETE i, r
neo4j-sh (?)$ MATCH (i:INCIDENT)-[r]-()> USING INDEX i:INCIDENT(incident_id)> WHERE i.incident_id = '00000000' DELETE i, r;+-------------------+| No data returned. |+-------------------+Nodes deleted: 1Relationships deleted: 169 msMERGE (i:INCIDENT { incident_id : '11110000' })ON CREATE SET i.incident_timestamp = 'test',i.incident_description = 'test'RETURN i.incident_id
neo4j-sh (?)$ MERGE (i:INCIDENT { incident_id : '11110000' })> ON CREATE SET i.incident_timestamp = 'test',> i.incident_description = 'test'> RETURN i.incident_id;+---------------+| i.incident_id |+---------------+| "11110000" |+---------------+1 rowNodes created: 1Properties set: 3Labels added: 1128 ms
MATCH (ntl:NHS_TRUST_LOCATION), (i:INCIDENT)USING INDEX ntl:NHS_TRUST_LOCATION(location_level_01)USING INDEX i:INCIDENT(incident_id)WHERE ntl.location_level_01 = 'General / acute hospital'AND i.incident_id = '11110000' CREATE UNIQUE(i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)RETURN r
neo4j-sh (?)$ MATCH (ntl:NHS_TRUST_LOCATION), (i:INCIDENT)> USING INDEX ntl:NHS_TRUST_LOCATION(location_level_01)> USING INDEX i:INCIDENT(incident_id)> WHERE ntl.location_level_01 = 'General / acute hospital'> AND i.incident_id = '11110000' > CREATE UNIQUE> (i)-[r:IS_NHS_TRUST_LOCATION_INCIDENT]->(ntl)> RETURN r;+---------------------------------------------+| r |+---------------------------------------------+| :IS_NHS_TRUST_LOCATION_INCIDENT[24515887]{} |+---------------------------------------------+1 rowRelationships created: 156 ms
MATCH (i:INCIDENT)-[r]-()USING INDEX i:INCIDENT(incident_id)WHERE i.incident_id = '11110000' DELETE i, r
neo4j-sh (?)$ MATCH (i:INCIDENT)-[r]-()> USING INDEX i:INCIDENT(incident_id)> WHERE i.incident_id = '11110000' DELETE i, r;+-------------------+| No data returned. |+-------------------+Nodes deleted: 1Relationships deleted: 172 ms--