# Delete graph

**URL:** <https://discuss.dgraph.io/t/delete-graph/14664>\
**Category:** Dgraph\
**Tags:** java-client, kind:question, area:schema\
**Created:** [June 21, 2021, 1:22am UTC](https://discuss.dgraph.io/t/delete-graph/14664 "2021-06-21T01:22:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricecold](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ricecold/32/8370_2.png) [@ricecold](https://discuss.dgraph.io/u/ricecold)\
**Post date:** [June 21, 2021, 1:22am UTC](https://discuss.dgraph.io/t/delete-graph/14664/1 "2021-06-21T01:22:05Z")

</div>

It takes about 5 seconds for deleting one predicates,so I have to take lots of time while delete a type with several predicates,how can i delete a type with predicates faster?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [June 21, 2021, 1:26am UTC](https://discuss.dgraph.io/t/delete-graph/14664/2 "2021-06-21T01:26:36Z")

</div>

5s? Can you share your query? is your predicate too big?

---

<div class="post-metadata">

**Author:** ![ricecold](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ricecold/32/8370_2.png) [@ricecold](https://discuss.dgraph.io/u/ricecold)\
**Post date:** [June 21, 2021, 1:34am UTC](https://discuss.dgraph.io/t/delete-graph/14664/3 "2021-06-21T01:34:29Z")

</div>

![Snipaste_2021-06-21_09-33-56](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/d/d7612f30fdffec2b76f2dc8b8a20aa483016ee73.png)

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [June 21, 2021, 1:54am UTC](https://discuss.dgraph.io/t/delete-graph/14664/4 "2021-06-21T01:54:29Z")

</div>

Sorry, but this alone doesn’t help.

---

<div class="post-metadata">

**Author:** ![ricecold](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ricecold/32/8370_2.png) [@ricecold](https://discuss.dgraph.io/u/ricecold)\
**Post date:** [June 21, 2021, 2:05am UTC](https://discuss.dgraph.io/t/delete-graph/14664/5 "2021-06-21T02:05:21Z")

</div>

Each type has 10 to 50 predicates, a total of more than ten types, each type has thousands to tens of thousands of data.  
The picture shows that 10 predicates start with “ENTERPRISE.LICENSE” belong to a type named “ENTERPRISE.LICENSE” has 8410 data

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [June 21, 2021, 2:10am UTC](https://discuss.dgraph.io/t/delete-graph/14664/6 "2021-06-21T02:10:00Z")

</div>

Humm, let’s go by parts. You were saying that your query (delete mutations) was taking 5 seconds to complete. Right? How did you do this specific query and its data was too big? What did you actually do? Let’s talk about the other possibilities after I understand your case.

PS. Also, are you using DQL or GraphQL?

Cheers.

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [June 21, 2021, 2:12am UTC](https://discuss.dgraph.io/t/delete-graph/14664/7 "2021-06-21T02:12:05Z")

</div>

Screenshot is from Ratel which is using DQL, but this topic is categorized as GraphQL. So maybe by showing us an example of your query this might need recategorized as DQL. The delete syntax between the two of them is quite different as well.

---

<div class="post-metadata">

**Author:** ![ricecold](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ricecold/32/8370_2.png) [@ricecold](https://discuss.dgraph.io/u/ricecold)\
**Post date:** [June 21, 2021, 3:57am UTC](https://discuss.dgraph.io/t/delete-graph/14664/8 "2021-06-21T03:57:35Z")

</div>

I just want to delete several predicate and recreate them with java api,but while I delete the old and create the new with the same predicate name,it always out of time, so i operate it by Ratel UI and find that it takes a long time to delete predicates,so i guess the proplem is the deleteing operation.

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [June 21, 2021, 4:24am UTC](https://discuss.dgraph.io/t/delete-graph/14664/9 "2021-06-21T04:24:24Z")

</div>

so you are using: [https://dgraph.io/docs/clients/java/#altering-the-database](https://dgraph.io/docs/clients/java/#altering-the-database) ?

I am wondering if maybe you are being blocked by:

> An alter operation will also fail if one is already in progress with an error `schema is already being modified. Please retry` . Though, mutations can be successfully executed while indexing is going on.

So indexing should not block you, but an ongoing schema update would.

But maybe this will add some more context to what you are trying to achieve:

> [@How to drop predicate data](http://discuss.hypermode.com/t/how-to-drop-predicate-data/6837/4):
>
> @JimWen The data won’t be removed from disk when you drop/delete anything. The delete operation is logical which means a new entry with delete marker will be added and it will be eventually removed (along with the older keys) by compaction/garbage collection. In simple words, the disk usage won’t be affected instantly by the drop operation. As for the data showing up in the /state endpoint, that shouldn’t happen. Which version of dgraph are you using? Can you share some logs? It might be possib…

---

<div class="post-metadata">

**Author:** ![ricecold](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/ricecold/32/8370_2.png) [@ricecold](https://discuss.dgraph.io/u/ricecold)\
**Post date:** [June 21, 2021, 10:59am UTC](https://discuss.dgraph.io/t/delete-graph/14664/10 "2021-06-21T10:59:39Z")

</div>

Yes ,I’m using the java api to altering the database and I try it again by using Ratel UI,however I find it hard to delete or change the predicates because it takes about 10s even if I operate an empty predicate(with no uid).I consider maybe the database exist lots of deleted data in the disk,I think I should read the docs carefully again.Thanks for your help.
