Many developer’s are trying to delete whole sObject records using SOQL query like SQL “Truncate table” but salesforce force.com platform doesn’t support that.
Truncate “Table/sObject” means logically equivalent to the Delete [Select Id From Account];.
Salesforce has option to truncate custom object records using Truncate button. By default you can’t see the Truncate button on the UI. You have to contact your administrator enable “Truncate” option.
Please follow steps to enable Truncate:-
- Go to Setup under your name on the right most corner.
- Type “User Interface” in QuickFind search box on the left.
- Click “User Interface” like and check “Enable Custom Object Truncate” flag to True.
- Click Save.
- Now you can see Truncate button on custom object. Once you clicked button data will be deleted from that object with in few seconds.
How data deleted from Salesforce in few seconds? Once you clicked Truncate button - creating new table with same structure and renaming old table into "TableName_trunc".
Note: if you are not able to Truncate button on the custom object then check is there any custom indexed field exists then please create salesforce support case to remove fields custom index for that object. Data storage not going to increase once you clicked Truncate button it will take 15 days to remove from your org. If you want to remove immediately then you need to create another salesforce support case.