2016-07-13 4 views
0

Neo4j(コミュニティバージョンを使用)を評価しようとしています。
LOAD CSVプロセスを使用してデータ(100万行)をインポートしています。以前にインポートされたノードと照合して、それらの間の関係を作成する必要があります。ここでNeo4j CSVのインポートクエリは、関係を設定するときにスローです。

は私のクエリです:

//Query #3 
//create edges between Tr and Ad nodes 

USING PERIODIC COMMIT 
LOAD CSV WITH HEADERS FROM 'file:///1M.txt' 
AS line 
FIELDTERMINATOR '\t' 

//find appropriate tx and ad 
MATCH (tx:Tr { txid: TOINT(line.txid) }), (ad:Ad {p58: line.p58}) 

//create the edge (relationship) 
CREATE (tx)-[out:OUT_TO]->(ad) 

//set properties on the edge 
SET out.id= TOINT(line.id) 
SET out.n = TOINT(line.n) 
SET out.v = TOINT(line.v) 

私が上なインデックスがあります

Indexes 
    ON :Ad(p58)  ONLINE (for uniqueness constraint) 
    ON :Tr(txid)  ONLINE        
    ON :Tr(h)   ONLINE (for uniqueness constraint) 

は、このクエリは、現在5日間で実行されていて、それが今のところ(1Mのうち)270Kの関係を作成しました。
Javaヒープは
マシンは唯一のLinuxとのNeo4j

このプロセスアップは高く評価されるだろう高速化するために任意のヒントを実行し、RAMの32GおよびドライブのSSDを持っているの4Gれます。
エンタープライズ版をお試しください。

クエリプラン:

+--------------------------------------------+ 
| No data returned, and nothing was changed. | 
+--------------------------------------------+ 
If a part of a query contains multiple disconnected patterns, 
this will build a cartesian product between all those parts. 
This may produce a large amount of data and slow down query processing. 
While occasionally intended, 
it may often be possible to reformulate the query that avoids the use of this cross product, 
perhaps by adding a relationship between the different parts or by using OPTIONAL MATCH (identifier is: (ad)) 
20 ms 

Compiler CYPHER 3.0 

Planner COST 

Runtime INTERPRETED 

+---------------------------------+----------------+---------------------+----------------------------+ 
| Operator      | Estimated Rows | Variables   | Other      | 
+---------------------------------+----------------+---------------------+----------------------------+ 
| +ProduceResults     |    1 |      |       | 
| |        +----------------+---------------------+----------------------------+ 
| +EmptyResult     |    |      |       | 
| |        +----------------+---------------------+----------------------------+ 
| +Apply       |    1 | line -- ad, out, tx |       | 
| |\        +----------------+---------------------+----------------------------+ 
| | +SetRelationshipProperty(4) |    1 | ad, out, tx   |       | 
| | |        +----------------+---------------------+----------------------------+ 
| | +CreateRelationship   |    1 | out -- ad, tx  |       | 
| | |        +----------------+---------------------+----------------------------+ 
| | +ValueHashJoin    |    1 | ad -- tx   | ad.p58; line.p58   | 
| | |\       +----------------+---------------------+----------------------------+ 
| | | +NodeIndexSeek    |    1 | tx     | :Tr(txid)     | 
| | |        +----------------+---------------------+----------------------------+ 
| | +NodeUniqueIndexSeek(Locking) |    1 | ad     | :Ad(p58)     | 
| |        +----------------+---------------------+----------------------------+ 
| +LoadCSV      |    1 | line    |       | 
+---------------------------------+----------------+---------------------+----------------------------+ 
+0

クエリプラン(クエリの先頭に 'EXPLAIN'を追加した結果)を追加できますか? –

答えて

1

OKAYは、その二つにMATCH文を分割することによって、それは非常にクエリをスピードアップ。プランに私を指摘してくれてありがとう@ウィリアム・リヨン。私は警告に気づいた。クエリが83秒かかった750Kの関係上

MATCH (tx:Tr { txid: TOINT(line.txid) }) 
MATCH (ad:Ad {p58: line.p58}) 

:2に

MATCH (tx:Tr { txid: TOINT(line.txid) }), (ad:Ad {p58: line.p58}) 

スプリットatatement

古いMATCH。
次の9百万のCSV LOAD

+0

9M行に30分かかり、 20M行に70分かかりました –

関連する問題