bestpractice – SOQL query performance with many or few fields
I have a doubt. Sometimes the developer repeats many queries in different places, but what changes is the number of fields. I sometimes think about centralizing queries, but queries can have fields that you won’t use in one place, but can use elsewhere. If I do a query with 5 fields, using “LIMIT 1” and another query on the same object using 15 fields, and also using “LIMIT 1”. Is there a performance loss due to the number of fields? And if there is a loss of performance, this loss is insignificant?
For example:
SELECT Id, Name, Type, SLA__c, Active__c, CustomerPriority__c FROM Account WHERE Id =: numId AND LIMIT 1
SELECT Id, Name, Type, SLA__c, Active__c, CustomerPriority__c, NumberofLocations__c, UpsellOpportunity__c, SLASerialNumber__c, SLAExpirationDate__c, First_Name__c, Founding_Date__c FROM Account WHERE Id =: numId AND LIMIT 1
Read more here: Source link