Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
I have nearly 300,000 account records in my org. I have the following class in my org:

global class testReadOnly{

@ReadOnly webservice static List getAcc()

{ return([select id from Account]); }

}

When I tried calling this method like testReadOnly.getAcc(); I get the following error:EXCEPTION: System.LimitException: Too many query rows: 50001

 Documentation says @ReadOnly returns upto 1 million rows. Please note that I have not performed any DML, sent emails or anything else in this transaction.

Can anyone tell me why am I getting the error even though I use @ReadOnly annotation. Thanks.
7 answers
  1. Jul 17, 2016, 1:57 PM
    Well it looks so at top level, but the developer console also send an API call to salesforce to execute something.

    You can refer the debug logs and see, it says Type = API
Loading
0/9000