0

When I execute this query

List<AggregateResult> query = [
    SELECT Max(Id) Id, AccountId, Max(CustomField__c) 
    FROM Asset WHERE Status = 'X' 
    AND (CustomField__c = 'Z' 
    OR CustomField__c = 'Y') 
    GROUP BY AccountId LIMIT 1000
];

The first time, happen an error:

Internal Salesforce.com Error

But the second time, I executed this query, the result with success

enter image description here

Why does this happen?

Edit 1:

Today, I executed this query in the organizer query plugin, and, first time, this was the result:

enter image description here

in the second time, this was the result:

enter image description here

7
  • In which context do you execute your query ? Jun 22 at 19:57
  • this query execute in a schedule job... Jun 22 at 19:58
  • 1
    This can be because of CPU time limit exceed , query limit etc. Try to check if you are not hitting any specific limits before this query. Jun 22 at 20:04
  • thank you for your answers, this query is the first thing my job executes, so, I am not hitting any specific limits before this query Jun 22 at 20:43
  • 1
    this looks like a tablescan query so you may be hitting limits; add some indexed fields (like created/lastmodifiedDate) to see if you get more consistent results
    – cropredy
    Jun 23 at 9:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.