Fastest way to Bulk Event Delete?

Hello dhis2 community!

Our team is running a .csv file of event UIDs through a DELETE call in the Postman running, however it takes many hours to iterate through the many events.

I’m wondering if anyone has experience with deleting a large number (60,000+) of events at one time in a reasonable amount of time.

Lauren Fregosi - MSF OCP


Hi @lnfregos,

Welcome back! :slight_smile: :tada:

This is interesting that you need to delete 60,000+ all at once! It sounds like one of the challenges to learn about when working on an implementation. Feel free to explain the situation more for the benefit of the community if you like please.

As for your question, if you have access to the database using pgadmin might be the fastest way; however, if you must use the API then bulk delete is possible using SYNC import strategy.

From a similar topic, I found a suggestion by @vgarciabnz:

You’ll have all UIDs with the parameter “deleted”: true for each UID all in one request.

Hope this helps! :+1:

Is this a normal part of your program flow? If not and this is a one off, I would backup the database and go in there manually and delete the events using a temp table to hold the IDs.

That said, looks like Gassim has found a solution that will allow you to delete in bulk and it looks like it fits the bull.

1 Like