outcaste-io / issues

File issues here across all public Outcaste Repositories
Apache License 2.0
6 stars 0 forks source link

Delete all data in type generates too many triples error #4

Open manishrjain opened 2 years ago

manishrjain commented 2 years ago

Original post: https://discuss.dgraph.io/t/delete-all-data-in-type-generates-too-many-triples-error/13991

I wanted to delete all nodes in a type. I can do such with a mutation such as:

mutation { deleteMyType(filter: {}) { numUids } } The filter is required, but providing an empty filter does the delete all syntax I am looking for. :heavy_check_mark:

However when working with a type that has many nodes and many predicates for every node I quickly found the error, (can’t remember exact specifics, should have copied it down)

Mutation generated too many tripples. Generated X triples and limit set at 100000.

So I had to apply a filter to delete a subset of these nodes at a time. This might have been problematic if I didn’t have any other fields to filter to a smaller subset of these nodes.

I am not sure where the exact tripples/rdf came from that was generated. My count of the type was under the limit, and so I was thinking doing a delete on the nodes using the S method would have been under the triple limit. I am thinking it did more of a S O * delete method though which might have retained any data for the nodes that was not mapped into my GraphQL schema? That would be an interesting test, to see exactly what got deleted If I run a DQL mutation before the delete to add some data on a predicate that is not mapped to GraphQL.

I thought that maybe I would just do the limit method to delete the first X and then the next X after that completed, but that didn’t work because the deleteMyType generated mutation does not have first property, only filter.

Possible solutions:

add the first input option to the delete mutation work around this limit by correctly deleting under the hood a subset at a time under the tripple limit. tweak the delete syntax to use a broader S syntax?