Skip to content

DROP TAG

DROP TAG drops a tag with the given name in the current working graph space.

A vertex can have one or more tags.

  • If a vertex has only one tag, the vertex CANNOT be accessed after you drop it. The vertex will be dropped in the next compaction. But its edges are available, this operation will result in dangling edges.
  • If a vertex has multiple tags, the vertex is still accessible after you drop one of them. But all the properties defined by this dropped tag CANNOT be accessed.

This operation only deletes the Schema data. All the files or directories in the disk will not be deleted directly until the next compaction.

Compatibility

In NebulaGraph 3.8.0, inserting vertex without tag is not supported by default. If you want to use the vertex without tags, add --graph_use_vertex_key=true to the configuration files (nebula-graphd.conf) of all Graph services in the cluster, and add --use_vertex_key=true to the configuration files (nebula-storaged.conf) of all Storage services in the cluster.

Prerequisites

  • Running the DROP TAG statement requires some privileges for the graph space. Otherwise, NebulaGraph throws an error.
  • Before you drop a tag, make sure that the tag does not have any indexes. Otherwise, the conflict error ([ERROR (-1005)]: Conflict!) will be returned when you run the DROP TAG statement. To drop an index, see DROP INDEX.

Syntax

DROP TAG [IF EXISTS] <tag_name>;
  • IF NOT EXISTS: Detects if the tag that you want to drop exists. Only when it exists will it be dropped.
  • tag_name: Specifies the tag name that you want to drop. You can drop only one tag in one statement.

Example

nebula> CREATE TAG IF NOT EXISTS test(p1 string, p2 int);
nebula> DROP TAG test;

Last update: November 10, 2023