I'm running a very simple SOQL query which I've renamed objects and included here:
List <ObjectA__c> allRecords= [ select name, Id,Contact__c,... from ObjectA__c where Contact__c IN (SELECT Contact__c FROM ObjectB__c WHERE id IN :idList) ];
ObjectB has only 300 records, objectA has over 200k, so it's clearly that object that's causing the problem.
id is indexed, obviously, and objectB's contact field is a master-detail so that's indexed too, and cannot include a null.
I'm open to any suggestions that might help. Troubleshooting has only produced this error in imports (where the idList is built off trigger.new) and running the code manually in anon apex runs fine without problems.
I'm running out of "things to try" so would welcome advice.