+ Start a Discussion
DJ Rock your own styleDJ Rock your own style 

Visualforce loading is delayed

Dear all,


We have made a vf for opportunity which is called on click of a button in the opportunity related list. The problem is with performance wherein it takes much more time to load than expected.


We thought of the following solution:


In code where we are querying the opportunities to show on VFpage, we can use an external id field (indexed  field) to concatenate the fields on which we are making a filter (AND clauses)


Here is our query:


  lstOpportunity = [Select o.Id, o.Name, o.Status__c,o.Account.City_EFS_c__r.Name,o.Account.Pin_Code_EFS_c__r.Name,o.opportunity_status__c,o.Product_Name__r.name, o.Product_Name__r.category__c,
                              o.Account.Id, o.Account.Name, o.Account.LastName__c,o.Account.CIS_No_new__c,Loan_Amount__c 
                              From Opportunity  o where 
                              o.Status__c ='Active' and o.opportunity_status__c =''
                              and o.Product_Name__r.category__c =: strCategory 
                              and o.Product_Name__r.Name=:strProduct
                              and o.Account.City_EFS_c__r.Name =: strCity 
                              and o.Account.Pin_Code_EFS_c__r.Name =: strPincode 
                              and o.Id not in :lstOppWithAppsIds];



Is it possible to index a concatenated field?


Is the approach we are talking about achievable?


Please let us know if anyone has worked on it. Any help will be appreciated.


If by concatenated you mean a formula field that pulls all those fields together, then no, as formula fields aren't persisted to the database.


If you mean a field that is maintained through workflow/triggers that actually contains the concatenated string, then that will help.


However, the SOQL query isn't usually the bottleneck in these situations.  Its usually down to the amount of data that is being returned - what sort of volumes are you getting?


There's a recording of a great Dreamforce 11 session on improving Visualforce performance at:



DJ Rock your own styleDJ Rock your own style

Hi Bob,


Thanks for ur immediate reply.


The amount of records is around 1.3 million and counting


And how many of these are likely to be returned to the visualforce page?

DJ Rock your own styleDJ Rock your own style

Around 30 or so


Well that shouldn't cause too much of an issue as long as the records aren't huge.

DJ Rock your own styleDJ Rock your own style

Hi Bob,


If I am correct, the records displayed are less but the records queried will be the total number of records right?


Yes, that's correct.  You could also look at having custom indexes on the fields that you are filtering by - SFDC would need to set these up for you.