I have billions of records.But there are 4-5 records which are duplicate.What is the best way to get those duplicate records which must be optimized and have good performance.

closed as too broad by Eric, Vamsi Krishna, Samuel De Rycke Nov 3 '15 at 10:43

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


The idea is all about combining the fields which you can tell whether two records are duplicate or not. Say if two records have the same firstname, secondname and email, you will consider them to be duplicate, then what you need is a formula field which combines them all together like: firstname + secondname + email. Let's call it duplicateFormula__c field. Then just use this query:

Select count(name), duplicateFormula__c From YourObject__c Group by duplicateFormula__c Having count(name) > 1

Now you will get an idea about which ones are duplicate.

Not the answer you're looking for? Browse other questions tagged or ask your own question.