Questions tagged [performance]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4
votes
2answers
5k views

Best place to declare variables in salesforce

We have had quite intensive discussions regarding the same topic in the programmer's communities. The two main view points are As close to the first use - To limit scope and improve performance ...
0
votes
0answers
24 views

How to optimize joined query to find obsolete data

We have a query to find and remove the obsolete data which looks like this: select Id,Name from Matter__c where Id NOT IN (select Matter_Number_Lookup__c from Matter_Sitting__c) So if a matter ...
2
votes
1answer
59 views

Performance under large data - standard features

When the number of records in the database increase, logically there must be decrease in performance. This degradation can be explicitly observed in SOQL/list view/reports on such orgs especially ...
1
vote
1answer
795 views

Bulkify the code?

I want to clone the Opportunity record if some conditions satisfied in Opportunity car set which is in related list. Opportunity (Master)--->Opportunity car set(Child) My below code is working fine....
17
votes
4answers
731 views

Anyone else seeing unexpected “System.LimitException: Apex CPU time limit exceeded” in previously working code?

In the last 24 hours several of our Jenkins (Continuous Integration server) builds have started failing with: System.LimitException: Apex CPU time limit exceeded exceptions in unit tests that have ...
3
votes
1answer
229 views

Trigger Best Practices

How would you rewrite the following trigger to follow best practices re: bulkification, etc? trigger Order_PopulateGallery on RH_Order__c (before insert, before update){ List<Account> accs = ...
37
votes
2answers
2k views

Why Would I Not Enable Chaining?

The Apex Design Patterns is an awesome resource, and I learned many tricks from it. One of my favorites is method chaining, and I quickly developed an axiom: Any time you would return void, return ...
2
votes
1answer
75 views

Apex Performance Query

I have the following scenario occuring in my code: Custom Object A has 100 records. Custom Object B also has 100 records (every record of B will have a corresponding record with A). for (...
10
votes
1answer
452 views

Most Efficient Method to Convert Set Type?

I have a twist on this question. What is the relative performance of each of the following methods? Via Peter Knolle: public static Set<String> deserializeToStrings(Set<Id> input) { ...
1
vote
1answer
314 views

Apex Loop Optimize

Here is my code // dynamic fields, the same with queried fields of Database.query(sqlStr) String fieldList = 'Id, Name, Number, Text__c..........'.split(','); for(SObject sob : Database.query(...
14
votes
2answers
8k views

Performance: List.get(index) vs List[index]

I want to know which approach is better in Salesforce when getting element from list. Is this faster? myList.get(0); Or is this faster? myList[0]; Using large list which above statement is more ...
2
votes
1answer
1k views

Apex Page Attributes - Performance Impact

I would like to better understand how each of the following attributes on an apex:page tag (or any notable omissions) affect load times. applyBodyTag applyHtmlTag docType showHeader sidebar ...
34
votes
2answers
6k views

When To Use Set vs. List In SOQL

I have always assumed that it is better to use a Set in my query filters instead of a List. For example: Set<Id> parentIds = generateParentIds(); List<Child__c> children = [SELECT Id FROM ...
4
votes
0answers
73 views

how to see view state size for non system administrator profiles?

I am working on a product in which multiple profiles are applicable for same features (Data is coming according to profile and there are also some layout changes). I like to see the view state of page ...
0
votes
1answer
48 views

On Trigger: System.LimitException: Too many SOQL queries: 101

I have issue with the below code when executing gives the error "System.LimitException: Too many SOQL queries: 101". Is there a way to optimize the below code? As per the error log, it happens when ...
4
votes
2answers
705 views

Performance issue when deleting Opportunity Line Items

I'm writing APEX REST API that creates OpportunityLineItem, Product2, Quote objects, updates Opportunity etc. based on data in JSON format received from external system. During testing I experienced ...
1
vote
0answers
23 views

Migration tool took more than the expected time to finish the deployment

Validations and deployments via migration tool to a sandbox took more than the expected time to finish the deployment. Total deployment/validation time supposed to be roughly 30 minutes and suddenly ...
1
vote
1answer
75 views

Improving Visualforce Performance

We have noticed that the initial load has a long delay but subsequent page loads are much faster. Is this some caching that is being done by salesforce internally or inside the ORg. How long is the ...
1
vote
1answer
405 views

Large delay between FLOW_BULK_ELEMENT_BEGIN flow element and FLOW_CREATE_INTERVIEW_BEGIN

We have a flow, and have noticed it has greatly increased the time it takes for a bulk (200 record) transaction to complete. We've narrowed down the delay to a 78 second delay between ...
0
votes
1answer
148 views

Query Optimisation

I currently have a function which looks like this: public void getContacts() { try { contacts = Database.query(query + ' LIMIT 15'); } catch (Exception e) { ApexPages.addMessage(new ...
1
vote
0answers
146 views

Large time gap in debug log before ENTERING_MANAGED_PKG

When viewing a debug log where the logging level was set to: APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO I am seeing a large ...
2
votes
1answer
405 views

Strange, slow behavior during ordering w/ REST API

I'm seeing some very bizarre SOQL performance when ordering by Id across several Sobjects. In this, they seem to take a very long time to select even just Ids when asked to sort by Id. Remove the ...
4
votes
2answers
65 views

Is “System.QueryException: non-selective query” Only Thrown From Triggers

Is it true that "System.QueryException: non-selective query" is only ever thrown from a trigger? If so, where is this documented and what happens when an identical query (one that throws "System....
4
votes
1answer
592 views

QueryException: Non-selective query against large object type (SOSL)

The following SOSL is in an Account trigger in a managed package: /* Trigger is on API 27.0 */ String acctsNamesOrd = 'PARKER/VANGUARD MGT'; Map<Integer, String> acctsNames = new Map<...
2
votes
1answer
209 views

I want to improve Salesforce1 Mobile performance

I am having problems with the performance on Salesforce1 Mobile specifically the loading times of visualforce pages, I have tested those visualforce pages independently using the developer console and ...
6
votes
2answers
408 views

Batch Apex and performance

I have a batch class that converts thousands of Visualforce pages to PDFs and stores the PDF files into a folder (in documents). The batch seems to work fine, but the process will take hours to ...
1
vote
1answer
126 views

Comparing Strings vs. Boolean Speed

We're looking to track where certain records were created (e.g. from a User within Salesforce, from our website etc...). We're wondering what is the best and least CPU intensive way of querying these ...
8
votes
1answer
885 views

Expense of using System.debug

I've seen code on an inherited project output debug info while iterating large collections of objects. System.debug(Logginglevel.DEBUG, 'sQuery=' + sQuery); If the system logging level is set ...
2
votes
0answers
292 views

What is selectivity threshold?

In the example mentioned here(Force.com Query Optimizer) What happens for the below scenario: Total number of Records in Account table : 2,500,000 And all the records are created on Jan 1st 2015. ...
9
votes
1answer
6k views

Best practice to monitor Apex function execution time/performance?

We have been running on Salesforce platform for just over 6 months with considerate amount of customizations. The data volume has been growing and features have been added into existing codebase ...
1
vote
2answers
132 views

Possible to include different js files depending on the environment?

What's the best practice of including javascritps in salesforce? I want to minified and concat all js files used in our app. When we are developing we want to use js files as separte files but on ...
1
vote
1answer
32 views

Eclipse Save-to-Server Performance since Summer 15

We've been experiencing significant Save to Server issues from Eclipse. We filed a case, and Tier 3 made a change to our platform schema, but the problems continue. Is anyone else seeing severely ...
1
vote
1answer
119 views

Custom soql return too many rows

What is my best option to return the results of a query where the soql query by default returns too many rows (>50k)? From my understanding, SELECT COUNT() still cannot return a result >50k, but my ...
9
votes
2answers
4k views

What is the Function of aura:dependency?

I came across something that vastly improved the performance of the Lightning application that I am building. However, I am not sure exactly why. When my application initializes, I am calling a doInit ...
0
votes
2answers
33 views

Can I reduce the number of containers and (seemingly) redundant loops when querying parents and grandparents?

tl;dr - I'm retrieving fields on an object, the object's parent, and the parent's parent in a trigger - is there any way to make my code use less than 5 containers and remain bulkified? I have an ...
7
votes
1answer
2k views

Suggestion to avoid for loop inside a for loop

I'm starting out new in APEX. I created below method to call inside a trigger. I know my code below is not efficient calling loop inside a loop to avoid SOQL. I looked online for a day before posting ...
4
votes
1answer
254 views

Formulas in workflows & validation - lazy or eager evaluated?

I tried to run some tests in developer edition and didn't see great difference so I am not sure. Basically I have a case that CPU time is leaking somewhere and I suspect it's validation rules or ...
34
votes
2answers
314 views

Which kind of issues will be shown at trust.salesforce.com and which issues will be omited?

In the context of a different question, we encountered a deployment performance degradation on EU5 of between 6000% to 10000% using Metadata-API. This means that work (saving a single APEX file to the ...
7
votes
1answer
235 views

Syntactic vs Performance difference on object creation?

Is there any performance difference between: Contact con = new Contact(); con.Id = conId; con.AccountRoles__c = newRole; ... and... Contact con = new Contact( Id = conId, ...
5
votes
2answers
222 views

EU5 not usable for development: Metadata-API deployment on EU5 unresponsive

Today I encounter a severe performance degradation on Metadata-API deployment speed on EU5. I'm waiting > 950 seconds (sometimes > 1500 seconds), when it usually deploys in < 25 seconds... This is ...
1
vote
1answer
239 views

What are “tid” and “len” in Visual Force Remoting actions?

I have no knowledge of the SalesForce1 platform, but am required to performance test a few UI pages/endpoints of a customer applications using a JMeter script. SO far I have been able to invoke most ...
20
votes
0answers
423 views

Premature optimization is the…cure of all CPU timeouts? [closed]

According to Donald Knuth actually "is the root of all evil". But this doesn't seem to hold true on the Force.com platform and its CPU time Limit. After watching Paul Battisson's Faster Loops ...
2
votes
2answers
96 views

Need help optimizing a SOQL query

I am writing a simple trigger to tag lead duplicates based on two different fields, Email and our internal Lead ID (which we keep consisted between our own server DB and salesforce via integration). ...
12
votes
3answers
379 views

Metadata+ToolingAPI access on CS14 (and other pods) extremly slow & No Support?

We are working on CS14. Starting last Friday we are suffering form a extreme performance loss on CS14. Loading and Saving Metadata via Tooling/Metadata-API is very slow. Operations which usually ...
17
votes
3answers
4k views

Are sandboxes slower than production Orgs?

I've noticed quite often that sandbox instances are showing a slower performance during Metadata API and Tooling API access. Today this happened on cs14. The force.com IDE froze completely during a "...
18
votes
4answers
13k views

Efficiency of List.size() > 0 vs. !List.isEmpty()

Anyone have any data to support a claim for which of the following two expressions is more efficient (meaning faster)? The use case is determining whether a List is empty to inform an auxiliary method ...
0
votes
2answers
164 views

Need help in improving SOQL performance

I have a SOQL query as below (where clause only). This query is not performing upto the mark, may be because of like operator. How can I substitute this :- Where ( abc__c = 'chris' OR xyz__c = '...
1
vote
1answer
849 views

Why is my report taking forever to run?

When working with a very large dataset of Accounts, e.g., 10's of millions of records, I wanted to create a report to return a subsets of records, i.e., records filtered by country. I created a ...
3
votes
2answers
1k views

Track number of API calls for an application

I'm working on an application, which uses SOAP, REST and Bulk API to integrate with Salesforce. Is there any API call in Salesforce which enables me to track how much API calls did I consume in a ...
6
votes
2answers
2k views

SFDC European Data Center experiences

I see a new EU5 instance on trust.salesforce.com which has a 'LON' hovertext over it, assumingly referring to London. I can imagine some companies might be interested in having their data hosted in ...