If the stored procedure in the first request compiles the stored procedure, it also retrieves buffers and caches the result. In the second request, the procedure does not compile again (preached), and the results are instantaneous (the samples are also in memory for some operating systems, so there is no need for an io disk)
one way is to optimize sp or tables. What are they bigger? (number of records for each table)
one easy way to optimize this is to put a cron script that will run once a day / hour to prefill the caches so that you quickly get sp
source share