Salesforce Developer Interview Question

A data load fails with Too many SOQL queries: 101. How do you fix it?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Find where the queries come from before changing anything. Reproduce with a bulk test or a debug log and look for SOQL inside loops, in triggers, in helper methods called once per record, or in flows with Get Records inside loops. The limit is shared by everything in the transaction, including other triggers, flows and packages. Bulkify the offending code, then add a bulk test so it cannot come back.

Why interviewers ask this

This is the most famous Salesforce error, and how a candidate handles it reveals whether they understand bulkification and transaction scope. The interviewer wants a diagnostic approach using debug logs and bulk tests, awareness that queries from every piece of automation count towards one limit, and a fix that removes the pattern rather than moving it. Offering a smaller batch size as the only fix is a red flag.

How to structure your answer

  • Reproduce the failure with bulk data and a debug log.
  • Find every source of queries in the transaction.
  • Bulkify the code responsible.
  • Prevent a repeat with bulk tests and review habits.

Example answer

Spoken example, first person

The error means the transaction ran a hundred and one queries against a limit of a hundred, and with a data load that almost always means something queries once per record. First I reproduce it, either with a test that inserts two hundred records or by loading a small batch in a sandbox with a debug log running, and I look at where the SOQL statements come from. The obvious culprit is a query inside a for loop in a trigger, but it is often less direct: a harmless looking helper method that runs a query and gets called for every record, or a flow with a Get Records element inside a loop. The hundred is also shared by everything in that transaction, so my trigger might be fine alone but tip over once a managed package and two flows have taken their share. The fix is bulkifying the culprit: collect ids, query once, use a map. Reducing the data loader batch size can get a load through in an emergency, but it only masks the bug. Finally I add a bulk test so the problem cannot quietly return.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How would you find which automation is using the most queries?
  • What if the queries come from a managed package you cannot change?
  • How would you fix the same problem inside a flow?

Related salesforce developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot