Posts

Showing posts with the label Best Practices

Performance tuning of a visualforce page

Image
It's my strong belief that a developer should always keep the performance in the top of the priority list. As I was working on a big Visualforce page with lot of aggregations, I wondered how to get best performance out of APEX and VF.  I went through  Apex Code Best Practices  and  salesforce_visualforce_best_practices.pdf .  Both were really helpful, until I ran into following statements.  Apex Best Practice # 4 states " Use the power of the SOQL  where  clause to query all data needed in a single query. "   Visualforce guide states " When writing Apex or SOQL for use with a Visualforce page:  • Perform calculations in SOQL instead of in Apex, whenever possible. • Never perform DML inside a loop.  • Filter in SOQL first, then in Apex, and finally in Visualforce " Now, I am confused on writing a single SOQL and do the aggregations such as (max,min, sum, avg) in APEX or writing mult...