Deleting 1M documents from Appian

I have a case where i need to delete 1million documents from appian. so what I did is querying the appian doc ids from the DB and checking whether the appian has this document and proceeding with deletion.

for this i planned 2 approaches:

1. using a rule querying the doc ids from db. then, I will make an intersection with doc folder (getting list of doc ids in this folder) and doc id list to confirm those ids are in Appian and proceed with deletion.

2.adding a script task before deletion to whether doc is present in appian or not using isObjectexists then proceed with deletion(currently my environment has only delete single doc at one time)

which will be best solution and pros and cons of it or is there any other ways . I'm new to Appian can anyone help me this ?

Thanks in advance

  Discussion posts and replies are publicly visible