function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
niranjanniranjan 

Long Query Times

Hi,
 
My process has to retrieve 40,000 records from AccountShare table.
 
But what I observed the from the execution of the process is that it is taking very long time for the subsequent records.
 
i.e, it took - 3 hours  -  for first 4500 records
for next    - 3 hours  -  it processed only 1500 records.
for next    - 3 hours  -  it processed only 500 records
 
If anyone know why it is taking so long time for the subsequent queries please inform.
 
Awaiting for your reply.
 
Regards,
Niranjan.
 
 
benjasikbenjasik
Once you have a cursor (initial query has completed), the subsequent queries should all be very fast.  I'd suspect a network problem without knowing more.   
niranjanniranjan

This process retrieved 40,000 records from AccountTeamMember table and stored in teamMemberDto (in local memory).
Then the following query given below should get executed for 40,000 times on AccountShare table
for (i=0; i<40000;i++)
 queryResult = sfdcClient.query( sql +"'"+ teamMemberDTO.getAccountId() +"'"+
          " and UserOrGroupId = "+"'"+teamMemberDTO.getUserId() +"'");
      
 
But I observed the from the execution of the process is that it is taking very long time for the subsequent records.
 
Any suggestions?
 
Awaiting for your reply.