How to delete large amount of nodes in cypher











up vote
2
down vote

favorite












I'm trying to delete 1 million nodes in cyphper at one query using web admin(i.e localhost:7474/browser).

These nodes is labeled as User. I ran following query, then returned Unknown error after waiting about 1minutes.



match (u:User) delete u


This query returned Unknown error every time. and I confirm my PC resources didn't lack.
I'm using Neo4j version 2.0.0 RC1 community edition. and Neo4j Hosted on local.

Is My trying way for deletion nodes wrong?

Thanks










share|improve this question




























    up vote
    2
    down vote

    favorite












    I'm trying to delete 1 million nodes in cyphper at one query using web admin(i.e localhost:7474/browser).

    These nodes is labeled as User. I ran following query, then returned Unknown error after waiting about 1minutes.



    match (u:User) delete u


    This query returned Unknown error every time. and I confirm my PC resources didn't lack.
    I'm using Neo4j version 2.0.0 RC1 community edition. and Neo4j Hosted on local.

    Is My trying way for deletion nodes wrong?

    Thanks










    share|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I'm trying to delete 1 million nodes in cyphper at one query using web admin(i.e localhost:7474/browser).

      These nodes is labeled as User. I ran following query, then returned Unknown error after waiting about 1minutes.



      match (u:User) delete u


      This query returned Unknown error every time. and I confirm my PC resources didn't lack.
      I'm using Neo4j version 2.0.0 RC1 community edition. and Neo4j Hosted on local.

      Is My trying way for deletion nodes wrong?

      Thanks










      share|improve this question















      I'm trying to delete 1 million nodes in cyphper at one query using web admin(i.e localhost:7474/browser).

      These nodes is labeled as User. I ran following query, then returned Unknown error after waiting about 1minutes.



      match (u:User) delete u


      This query returned Unknown error every time. and I confirm my PC resources didn't lack.
      I'm using Neo4j version 2.0.0 RC1 community edition. and Neo4j Hosted on local.

      Is My trying way for deletion nodes wrong?

      Thanks







      neo4j cypher






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 7 '15 at 22:54









      ekkis

      3,989103770




      3,989103770










      asked Dec 10 '13 at 7:47









      Michael

      53111




      53111
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit and run the statement until all users are gone:



          match (u:User) with u limit 1000 delete u





          share|improve this answer



















          • 1




            Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
            – Michael
            Dec 10 '13 at 9:21












          • you're right, did a mistake in my answer.
            – Stefan Armbruster
            Dec 10 '13 at 10:10










          • OK, I see. Thanx
            – Michael
            Dec 10 '13 at 11:02


















          up vote
          0
          down vote













          With Neo4j 3.x and forward you can run large delete transactions using APOC too:



          call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
          yield batches, total return batches, total





          share|improve this answer




























            up vote
            -3
            down vote













            I've found that just removing the neo4j/data folder is the fastest way to delete the db.






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20488801%2fhow-to-delete-large-amount-of-nodes-in-cypher%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              5
              down vote



              accepted










              You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit and run the statement until all users are gone:



              match (u:User) with u limit 1000 delete u





              share|improve this answer



















              • 1




                Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
                – Michael
                Dec 10 '13 at 9:21












              • you're right, did a mistake in my answer.
                – Stefan Armbruster
                Dec 10 '13 at 10:10










              • OK, I see. Thanx
                – Michael
                Dec 10 '13 at 11:02















              up vote
              5
              down vote



              accepted










              You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit and run the statement until all users are gone:



              match (u:User) with u limit 1000 delete u





              share|improve this answer



















              • 1




                Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
                – Michael
                Dec 10 '13 at 9:21












              • you're right, did a mistake in my answer.
                – Stefan Armbruster
                Dec 10 '13 at 10:10










              • OK, I see. Thanx
                – Michael
                Dec 10 '13 at 11:02













              up vote
              5
              down vote



              accepted







              up vote
              5
              down vote



              accepted






              You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit and run the statement until all users are gone:



              match (u:User) with u limit 1000 delete u





              share|improve this answer














              You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit and run the statement until all users are gone:



              match (u:User) with u limit 1000 delete u






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Apr 28 '16 at 16:56









              istruble

              10.1k13948




              10.1k13948










              answered Dec 10 '13 at 8:52









              Stefan Armbruster

              34.2k46374




              34.2k46374








              • 1




                Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
                – Michael
                Dec 10 '13 at 9:21












              • you're right, did a mistake in my answer.
                – Stefan Armbruster
                Dec 10 '13 at 10:10










              • OK, I see. Thanx
                – Michael
                Dec 10 '13 at 11:02














              • 1




                Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
                – Michael
                Dec 10 '13 at 9:21












              • you're right, did a mistake in my answer.
                – Stefan Armbruster
                Dec 10 '13 at 10:10










              • OK, I see. Thanx
                – Michael
                Dec 10 '13 at 11:02








              1




              1




              Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
              – Michael
              Dec 10 '13 at 9:21






              Thank you for the advice. I tried to delete above query, but it returned an Unknown error. I executed an following query instead. match (u:User) with u limit 1000 delete u It works fine:) Thanx
              – Michael
              Dec 10 '13 at 9:21














              you're right, did a mistake in my answer.
              – Stefan Armbruster
              Dec 10 '13 at 10:10




              you're right, did a mistake in my answer.
              – Stefan Armbruster
              Dec 10 '13 at 10:10












              OK, I see. Thanx
              – Michael
              Dec 10 '13 at 11:02




              OK, I see. Thanx
              – Michael
              Dec 10 '13 at 11:02












              up vote
              0
              down vote













              With Neo4j 3.x and forward you can run large delete transactions using APOC too:



              call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
              yield batches, total return batches, total





              share|improve this answer

























                up vote
                0
                down vote













                With Neo4j 3.x and forward you can run large delete transactions using APOC too:



                call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
                yield batches, total return batches, total





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  With Neo4j 3.x and forward you can run large delete transactions using APOC too:



                  call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
                  yield batches, total return batches, total





                  share|improve this answer












                  With Neo4j 3.x and forward you can run large delete transactions using APOC too:



                  call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
                  yield batches, total return batches, total






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 11 at 13:30









                  ThirstForKnowledge

                  578112




                  578112






















                      up vote
                      -3
                      down vote













                      I've found that just removing the neo4j/data folder is the fastest way to delete the db.






                      share|improve this answer

























                        up vote
                        -3
                        down vote













                        I've found that just removing the neo4j/data folder is the fastest way to delete the db.






                        share|improve this answer























                          up vote
                          -3
                          down vote










                          up vote
                          -3
                          down vote









                          I've found that just removing the neo4j/data folder is the fastest way to delete the db.






                          share|improve this answer












                          I've found that just removing the neo4j/data folder is the fastest way to delete the db.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 28 '14 at 21:53









                          eighteyes

                          8791718




                          8791718






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20488801%2fhow-to-delete-large-amount-of-nodes-in-cypher%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Florida Star v. B. J. F.

                              Error while running script in elastic search , gateway timeout

                              Adding quotations to stringified JSON object values