delete vertex not working with out where

131 views
Skip to first unread message

ropel...@gmail.com

unread,
Aug 9, 2015, 10:11:18 PM8/9/15
to OrientDB
I'm using OrientDB 2.1.0 on Windows

I'm trying to delete all vertexes of a certain class (the new BATCH option looks helpful), but the DELETE VERTEX command doesn't do anything without WHERE.

E.g., when I run:

DELETE VERTEX MyVertex

I just get:

{
    "result": [
        {
            "@type": "d",
            "@version": 0,
            "value": 20
        }
    ],
    "notification": "Query executed in 0.055 sec. Returned 1 record(s)"
}

The same thing happens when I run "DELETE VERTEX MyVertex BATCH 100".

The query does run if I use:
DELETE VERTEX MyVertex WHERE @rid is not null

...but I get a GC memory error if I'm trying any more memory-intensive WHERE statement.

Unfortunately I also get an error when I try and append BATCH here:
DELETE VERTEX MyVertex WHERE OtherProperty is not null BATCH 100

Error:
com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #0: Encountered " <BATCH> "BATCH "" at line 1, column 53. Was expecting one of: <EOF> <AND> ... <OR> ... <ORDER> ... <GROUP> ... <LIMIT> ... <SKIP2> ... <OFFSET> ... <TIMEOUT> ... <FETCHPLAN> ... <LOCK> ... <NOCACHE> ... <PARALLEL> ... <UNWIND> ... ";" ... <AND> ... <OR> ... <GROUP> ... <ORDER> ... <UNWIND> ... <SKIP2> ... <OFFSET> ... <LIMIT> ... <FETCHPLAN> ... <TIMEOUT> ... <LOCK> ... <PARALLEL> ... <NOCACHE> ...

Thanks,
Ben

alessand...@gmail.com

unread,
Aug 10, 2015, 3:31:40 AM8/10/15
to OrientDB
Hi,
if you want to delete all vertexes of a class use this command " truncate class MyClass unsafe"

Regards,
Alessandro

ropel...@gmail.com

unread,
Aug 10, 2015, 8:26:08 AM8/10/15
to OrientDB
Thanks, I'll try that. Do you know if I am using the BATCH command correctly? I'm also trying to delete roughly half of an 8 million-vertex class.
Message has been deleted

alessand...@gmail.com

unread,
Aug 10, 2015, 8:46:32 AM8/10/15
to OrientDB
Hi,
try to use "DELETE VERTEX MyVertex LIMIT 100" instead of "DELETE VERTEX MyVertex BATCH 100".

Alessandro

ropel...@gmail.com

unread,
Aug 11, 2015, 8:55:04 PM8/11/15
to OrientDB
Thanks--I just tried this and Orient accepts the query, but it still gives me an "OutOfMemoryError: GC overhead limit exceeded" eventually.

alessand...@gmail.com

unread,
Aug 12, 2015, 5:23:21 AM8/12/15
to OrientDB
Hi,
I tried to cancel 3,000,000 of vertices with this java code and I had no problems.
for(int j=0;j<30000;j++){
g.command(new OCommandSQL("DELETE VERTEX MyVertex LIMIT 100")).execute();
g.commit();
}

Let me know how it goes.

Regards,
Alessandro.

ropel...@gmail.com

unread,
Aug 12, 2015, 12:03:35 PM8/12/15
to OrientDB
I'm using the Orient Studio browse page for basic SQL commands and writing functions in Javascript when necessary (since I don't know any Java), but I'm assuming that's not going to make a difference for memory errors or command parsing, right?

Also earlier I said that "DELETE VERTEX MyVertex LIMIT 100" didn't work, but that wasn't entirely accurate--it was the following query that was giving me the GC memory error:

"DELETE VERTEX MyVertex WHERE property1 IS NULL LIMIT 100"

Still, I don't see why the LIMIT option wouldn't work in conjunction with WHERE. Any ideas?

alessand...@gmail.com

unread,
Aug 13, 2015, 4:29:12 AM8/13/15
to OrientDB

Hi,
Could you send me your database so that I can test it or tell me the type of property1.

The previous function written in Java with JavaScript is the following:

var g=orient.getGraph();
for(j=0;j<30000;j++){
g.command('sql','DELETE VERTEX MyVertex LIMIT 100');
g.commit();
}

Regards,
Alessandro
Reply all
Reply to author
Forward
0 new messages