Skip to main content
3 of 3
deleted 11 characters in body

community plus user with sharing rule read/write on contact soqls running longer in winter 19

I need help in resolving the below issue.

I have a community plus user. The user is part of public group and the group has read/write access to all contact records and read access to account records in the entire org using Sharing Rules. This setup was working fine till winter 19.

Specifically SOQLs that read contacts that belongs to "accounts not linked to community user (AccountId in User table) " were working fine.

After winter 19 release, the soql running as community plus login user runs very slow specifically while quering contacts that does not belong to Accounts that are not directly linked to the community plus user record on User table. I was able to reproduce the issue with below Test code.

@isTest(SeeAllData=true) 
public class Test_Winter19 { 

static testMethod void demonstrate() { 
User u = [Select Id,AccountId from User where userName = '[email protected]']; 

Id accRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Seller Servicer Account').getRecordTypeId(); 
account acc = [Select Id from Account where id = '0014D000009yfeUQAQ']; 

contact con = new contact(FirstName = 'different', LastName = 'Account', email = '[email protected]', AccountId = acc.Id); 

contact con1 = new contact(FirstName = 'same', LastName = 'Account', email = '[email protected]', AccountId = u.AccountId); 

insert con; 
insert con1; 

System.runAs(u) { 
System.debug('*****************trying to read different account contact***************'); 
Long startTime = DateTime.now().addDays(-1).getTime(); 

//Contact diffAccContact = [Select Id from Contact where email='[email protected]']; 

Long endTime = DateTime.now().addDays(-1).getTime(); 
Long milliseconds = endTime - startTime; 
Long seconds = milliseconds / 1000; 
System.debug('*****************completed read different account contact***************'); 
System.debug('total time taken -- ' + seconds +' seconds'); 

System.debug('*****************trying to read same account contact***************'); 
startTime = DateTime.now().addDays(-1).getTime(); 
Contact sameAccContact = [Select Id from Contact where email='[email protected]']; 

endTime = DateTime.now().addDays(-1).getTime(); 
milliseconds = endTime - startTime; 
seconds = milliseconds / 1000; 
System.debug('*****************completed read same account contact***************'); 
System.debug('total time taken -- ' + seconds + ' seconds'); 
} 
} 
}

Below is screenshot of debug logs for time taken when running the test class from dev console.

enter image description here