Removes one or more records from the database. You can refine the set of records that it removes using the WHERE clause.

NOTE: Don't use DELETE to remove Vertices or Edges. Instead use the DELETE VERTEX or DELETE EDGE commands, which ensures the integrity of the graph. If you must carry out a DELETE you can use the UNSAFE keyword to do so. However, if you do, you'll end up with orphaned edge pointers, which you'll have to manually clean up.


DELETE FROM <Class>|CLUSTER:<cluster>|INDEX:<index> [LOCK <default|record>] [RETURN <returning>]
  [WHERE <Condition>*] [LIMIT <MaxRecords>] [TIMEOUT <timeout>]
  • LOCK Determines how the database locks the record between load and delete. It takes one of the following values:
    • DEFAULT Defines no locks during the delete. In the case of concurrent deletes, the MVCC throws an exception.
    • RECORD Defines record locks during the delete.
  • RETURN Defines what values the database returns. It takes one of the following values:
    • COUNT Returns the number of deleted records. This is the default option.
    • BEFORE Returns the number of records before the removal.
  • WHERE Filters to the records you want to delete.
  • LIMIT Defines the maximum number of records to delete.
  • TIMEOUT Defines the time period to allow the operation to run, before it times out.
  • UNSAFE Allows for the processing of a DELETE on a Vertex or an Edge, without an exception error. It is not recommended to use this! If you must delete an Edge or a Vertex, use the corresponding commands DELETE EDGE or DELETE VERTEX.


  • Delete all recods with the surname unknown, ignoring case:

    orientdb> DELETE FROM Profile WHERE surname.toLowerCase() = 'unknown'

For more information, see SQL Commands.

results matching ""

    No results matching ""