Create a script that runs the query 1000 times, or any number of iterations causes the results to stabilize.
Then follow your process as described above, but just make sure that you do not rely on one execution, but rather on the number of multiple executions, because you are right, the results will not be stable as the number of rows changes, and your machine does other things.
Also, try using a wide array of inputs for the query, if that makes sense for your use case.
source share