I have a relativley complex batch apex process that needs to pull in a large number of master objects based on a field on the master OR the detail object. However in my apex logic I need to ensure that each master object is processed fully within a single execute method.
This means that I can't really use the detail object as my query locator as if I do there's a chance that I'll get different detail objects for the same master in different execute chunks.
So this brings me to using a semi-join in the query locator my batch job starts with. Something like: SELECT id FROM Master__c WHERE Id IN (SELECT master__c FROM Detail__c WHERE master__r.theFieldICareAbout__c = true OR theFieldICareAbout__c = true)
However the data sets this needs to work on are poorly defined at best, in some cases I could be working on as few as 20,000 records, but in others I could be working on something close to 1.5 million detail objects.
I don't have any orgs available for testing at the higher end of this spectrum, so I have to ask, will I hit any governors trying to handle a colossal semi-join like this? Will it just fizzle out and die?