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.
In NebulaGraph 3.3.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.
- Running the
DROP TAGstatement 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 TAGstatement. To drop an index, see DROP INDEX.
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.
nebula> CREATE TAG IF NOT EXISTS test(p1 string, p2 int); nebula> DROP TAG test;