function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amol Jadhav 34Amol Jadhav 34 

SOQL takes more time for first time execution but subsequent request takes less

I have 5 million Opportunities, I am using vf with SOQL to fetch the Opportunities but for first request it is taking more time and subsquent requests are taking less, below is the sample query
Result = [SELECT Id, Name FROM Opportunity WHERE Name LIKE '%Test%' limit 2000]

 
Christian Schwabe (x)Christian Schwabe (x)
Hi,

a really good question. Here is the answer: https://salesforce.stackexchange.com/questions/25334/why-is-my-soql-query-slow-the-first-time-faster-subsequently

Kind regards,
Chris