Developer Console - Delete Multiple Records

You can delete records from the developer console with the line

delete [SELECT Id FROM MyObject];

However, this isn't going to delete 100k records successfully due to governor limits. You're going to need to use dataloader to export the 100k records, then use the export to delete the records.

Edit: Better than that, you can use LIMIT to select a subset, and then rerun the command after each execution

delete [SELECT Id FROM MyObject LIMIT 10000];

One way to delete using Developer Console is to first execute your query

SELECT Id from My_Custom_Object__c

Then highlight all the result rows and click on the Delete Row button at the bottom.

enter image description here


Using Apex Data Loader to delete records:

First, you have to export all the records (the ID will be sufficient) to a csv file. Then you can delete all the records based on that csv file. When you perform the delete make sure you map the ID column of the csv file to the Id column of the object.

This way took me a few minutes to delete 120K records (Lead).

Tags:

Apex