Ryan, I modified your script to use INT temp tables, instead of BIGINT, and got almost an 18% reduction in runtime. The following is the result of finding all primes below 100 million.
Using BIGINT for the data types doesn't seem to be needed unless you are going over 2 billion in your prime number search.
Test with INT temp tables Checkpoint A: 250 ms Checkpoint B: 230573 ms Finish: 652583 ms Number of primes Max prime Average of primes ---------------- ----------- -------------------- 5761455 99999989 48461680
Test with BIGINT temp tables Checkpoint A: 250 ms Checkpoint B: 280590 ms Finish: 791850 ms Number of primes Max prime Average of primes ---------------- -------------------- -------------------- 5761455 99999989 48461680