+ Start a Discussion
Zachariah RosenbergZachariah Rosenberg 

SOQL: How to bulkify querying for 10,000 individual records

Hello,

I'm trying to strategize how best to run this series of SOQL queries without triggering the limits. I have a csv of approximately 10,000 records. The goal is to check for each record whether there is a contact.owner.name associated with it. For instance (not complete, of course):

For(integer i:[csv file]){
SELECT Contact.Owner.Name. Contact.Custom_Field__c FROM Contact WHERE Contact.Custom_Field__c = csvFile[i]
}

How would you recommend I grab the data for all 10,000 records?

Thank you so much for your time and consideration of my inquiry.

With gratitude,
Zac
Anil SavaliyaAnil Savaliya
Hey Zac,

I am not clear about your requirment,But if you are doing dataload ,It's run in 200 record batch,even you are doing dataload for 10k record.
Zachariah RosenbergZachariah Rosenberg
Looking at some example queries, I think I need to use the WHERE var IN List clause. The "IN" part, I was missing. @Anil, are you saying that regardless of how many I pack into the list (WHERE var in list), it will run in 200 record batches? So a list of 1,000 records would be 5 batches or 5 SOQL queries?