I have an account that has 626,482 opportunities spread over 1,368 owners.
In the Developer Console if I run the following Apex
List<SObject> recs = [select sum(amount), ownerid from opportunity group by ownerid];
I get the error:
System.LimitException: Too many query rows: 50001: AnonymousBlock: line 1, column 1
which I expect.
Still in the Developer Console if I now go to the Query Editor and run the SOQL
select sum(amount), ownerid from opportunity group by ownerid
it runs and returns back the 1,368 records.
No governor limit hit.
In case the Developer Console has a special "I'm Salesforce" meaning if I run this Javascript on a VisualForce page
function query() {
jQuery.ajax('/services/data/v29.0/query/?q=' + encodeURIComponent('select sum(amount), ownerid from opportunity group by ownerid'), {
type: 'GET',
contentType: 'application/json',
beforeSend: function(xhr) {
// Set the OAuth header from the session ID
xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}');
},
processData: false,
dataType: 'json',
success: function(response) {
alert(response.records.length);
},
error: function(jqXHR, textStatus, errorThrown) {
// Oops - what went wrong?
alert(jqXHR.status + ': ' + errorThrown);
}
});
}
it also works without hitting any governor limit. I'm obviously missing which governor limit is being applied. Can someone point it out?
/services/data/v28.0/query/?q=SELECT+Id+FROM+Account
giving exact count of records in the totalSize attribute... – eyescream Jan 14 '14 at 17:00