Skip to content

Add Index to Log__c.ParentLogTransactionId__c #847

@jet89cook-google

Description

@jet89cook-google

New Feature Summary

We are using Nebula to log API requests coming into a custom REST endpoint. We are seeing some performance issues in a query (LogManagementDataSelector.getLogsWithoutParentLogByParentTransactionId: line 273 that is using a lot of resources.

We were seeing performance degradation and throttling enforcement (by Salesforce) when we hit a spike in the endpoint usage. One of the less performant queries that was contributing to the issue.

Query: SELECT Id, ParentLogTransactionId__c, ParentLog__c, ParentLog__r.TransactionId__c, TransactionId__c FROM Log__c WHERE (ParentLogTransactionId__c IN :tempVar1 AND ParentLog__c = NULL)

Salesforce suggested adding an Index to the ParentLogTransactionId__c field. I wasn't sure if this was possible to do from the package side, but it appears if you add it to a Dev Org (with Salesforce's help), you can include it in the package. Otherwise customers will need to add these (and any other indexes) on their own.

Ref: Salesforce Case#469926652

Usage:

public Object doPost() {
RestRequest request = RestContext.request;
Logger.info(request.requestURI).setRestRequestDetails(request);
//.. do stuff
Logger.saveLog();
return response;
}

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions