What is the maximum number of records retrieved by one SOQL query in a lightning Apex backend controller?

According to this:

Total number of records retrieved by SOQL queries | 50,000

But for me it is not clear why querieS and not query is used there.

Does it mean that in total in one call to Apex backend controller from my lightning component I can retrieve 50,000? Or does it mean that in one query I can retrieve 50,000?

1 Answer 1


"Queries" is plural because it is a cumulative limit across all queries called in a single transaction, not a per-query limit. Lightning components also use a "boxcar" behavior, so if you enqueue multiple actions at once, the 50,000 row limit will be split across all enqueued actions. You can get 50,000 rows in one query, but then you won't have any more rows left if you need a second query.

  • Could you, please, provide an example of enqueuing multiple actions at once? Dec 17, 2018 at 20:16
  • @oobarbazanoo var a1 = c.get("c.action1"), a2 = c.get("c.action2"); ... $A.enqueueAction(a1); $A.enqueueAction(a2);. if you do this, the limits are shared across both actions. This occurs up to about 5-6 enqueued actions at once. This has other effects, like if you callout after a DML, etc.
    – sfdcfox
    Dec 17, 2018 at 20:19
  • Does it depend on the performance of the device and internet whether or not the enqueued actions will be performed in one call? I mean if I will for instance have a bad network and enqueue one action, then in two minutes another and so on, but my network connect will stabilize only in half an hour, then all those actions will be executed simultaneously or will they be splitted? Dec 17, 2018 at 20:21
  • @oobarbazanoo There's an upper limit to how many actions will fire at once, but I'm not sure how the system decides this. It seems to be about 4-6 actions will go in each payload. When in doubt, use a Promise chain or call them in callback handlers. Usually, from what I've seen, it's pretty reasonable unless you're loading large amounts of data. There's also the setBackground action that can delay calls you know will be close to the limit.
    – sfdcfox
    Dec 17, 2018 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .