When executing the first alternate sql for the first time, the table is being read and the data is stored in the database buffers. When the second alternate sql is being run, the results would actually be faster, as it does not have to read the table but rather directly from the database buffers. Workaround is to actually run the alternate sql a few times to average the results so that we can determine which alternate sql is better. Is this true?
What is described is true and not only will the data cache affect the second run time, the caching of the tables/indexes will also play a similar role. The way to resolve is the same as described, ie. to execute the SQL for a second time to get a more consistent result. One note to that is we used to suggest this for fast running SQL statement because the caching time will have a higher effect to the overall run time. However, for long run time SQL, the caching time will have less effect to the overall run time so you may not need to run a long running SQL the second time.