function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yogesh BiyaniYogesh Biyani 

I would like to delete Contacts and Accounts from our database which have no related records

The following queries list the IDs of such accounts (400k+) and contacts(800k+). Workbench will display the result in a table however only a few (e.g. 50) are displayed in the table and then I have select "more" to see the next set. What is the best tool to export this large dataset?
 
1) select id ,(select id from AcceptedEventRelations) ,(select id from Accounts_Contacts__r) ,(select id from Attachments) ,(select id from CampaignMembers) ,(select id from Cases) ,(select id from Feeds) ,(select id from Histories) ,(select id from DeclinedEventRelations) ,(select id from EmailMessageRelations) ,(select id from FeedSubscriptionsForEntity) ,(select id from Events) ,(select id from EventRelations) ,(select id from Notes) ,(select id from OpportunityContactRoles) ,(select id from Quotes) ,(select id from Tasks) ,(select id from UndecidedEventRelations) ,(select id from simplesurvey__Surveys__r) from contact

2) select id ,(select id from CaseContactRoles) ,(select id from Tags) ,(select id from DuplicateRecordItems) ,(select id from GoogleDocs) ,(select id from Sertifi2_0__Signers__r) ,(select id from Personas) ,(select id from TopicAssignments) ,(select id from Zendesk__Zendesk_Tickets__r) from contact

3) select id ,(select id from Feeds) ,(select id from Histories) ,(select id from Attachments) ,(select id from Cases) ,(select id from Contacts) ,(select id from Emails) ,(select id from FeedSubscriptionsForEntity) ,(select id from Notes) ,(select id from Opportunities) ,(select id from Tasks) ,(select id from simplesurvey__Surveys__r) from Account

4) select id ,(select id from ChildAccounts) ,(select id from AccountPartnersFrom) ,(select id from AccountPartnersTo) ,(select id from Tags) ,(select id from AccountTeamMembers) ,(select id from Contracts) ,(select id from DuplicateRecordItems) ,(select id from Events) ,(select id from GoogleDocs) ,(select id from OpportunityPartnersTo) ,(select id from PartnersFrom) ,(select id from PartnersTo) ,(select id from Sertifi2_0__Sertifi_EContracts__r) ,(select id from Personas) ,(select id from TopicAssignments) ,(select id from Zendesk__Zendesk_Tickets__r) from Account


 
Ashish DevAshish Dev
dataloader is the best tool to export/import/delete large amount of data.