You need to sign in to do that
Don't have an account?
Pallav
Too many SOQL queries but in the Debug Log it shows only Number of SOQL queries: 3 out of 20 excuted
Hi All,
I am facing a very unusual situation in the Production instace. I have developed a trigger to populate some fields, it works absolutely fine in the sandbox instance. When I have moved the trigger to the production instance with 90% of code coverage. it is giving me the "Too many SOQL queries" exception when data loaded in bulk. But, in the Debug Log it shows only Number of SOQL queries: 3 out of 20 excuted. I am totally confused what is going on and have no idea what so ever why this is happening.
This is the line that is causing the error:
Map<Id, User> userRecords = new Map<Id, User>([Select Id, UserType from User where Id In : OwnerIds])
Here, "OwnerIds" is a list of Ids, which was got by:-
List<Id> OwnerIds = new List<Id>();
for (Integer i = 0; i < Trigger.new.size(); i++)
{
OwnerIds.add(trigger.new[i].OwnerId);
}
I would request you to kindly through some light on the situation that I am in. Hoping for a quick response from your side.
Also, thanks in anticipation of your answers.
Thanks and regards
Pallav
I am facing a very unusual situation in the Production instace. I have developed a trigger to populate some fields, it works absolutely fine in the sandbox instance. When I have moved the trigger to the production instance with 90% of code coverage. it is giving me the "Too many SOQL queries" exception when data loaded in bulk. But, in the Debug Log it shows only Number of SOQL queries: 3 out of 20 excuted. I am totally confused what is going on and have no idea what so ever why this is happening.
This is the line that is causing the error:
Map<Id, User> userRecords = new Map<Id, User>([Select Id, UserType from User where Id In : OwnerIds])
Here, "OwnerIds" is a list of Ids, which was got by:-
List<Id> OwnerIds = new List<Id>();
for (Integer i = 0; i < Trigger.new.size(); i++)
{
OwnerIds.add(trigger.new[i].OwnerId);
}
I would request you to kindly through some light on the situation that I am in. Hoping for a quick response from your side.
Also, thanks in anticipation of your answers.
Thanks and regards
Pallav
For example if you have a trigger on Opportunity that has 4 SOQL queries that updates an account and the Account has a trigger with 4 SOQL queries I believe your total is applied to your limit is 8 where if you just look at the debug log on one trigger it would only show 4.
Message Edited by TehNrd on 05-07-2008 01:12 PM