LoginSignup
0
0

More than 3 years have passed since last update.

【エラー対処】Neo4jでデータベースが大きすぎて一括削除できない

Last updated at Posted at 2019-10-23

はじめに

Neo4jで色々とデータをためていると

  • ノード数200000
  • リレーションはそれ以上

みたいな大量のデータになることがあります。

また、さらに使用環境が貧弱だと一括削除のコマンド

match(n) detach delete n

が使用できないことがあります。

There is not enough memory to perform the current task. Please try increasing 'dbms.memory.heap.max_size' in the neo4j configuration (normally in 'conf/neo4j.conf' or, if you you are using Neo4j Desktop, found through the user interface) or if you are running an embedded installation increase the heap by using '-Xmx' command line flag, and then restart the database.

そのため、一部ずつ削除していく必要があります。

対処法

match(n) with n limit 2000 detach delete n;

まず、match(n)で全部のノードを取り出します。
次に2000個にしぼりたいので、別のクエリーにデータを渡すwith句を使用します。
そして、n limit 2000で$2000$個のみに絞りこみ
最後にdetach delete n;で$2000$個を削除できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0