• Barry-193141 (3/3/2010)


    To counter performance issues, the easiest thing to do is add tablesample (10 percent) to the query.

    This way the newid() function only needs to run on an already randomized sample of 10 percent instead of against the entire data set.

    Just to sure never to use the technique with small tables - you'll likely get no rows at all.

    One other point for the general discussion: If a good distribution of random values is important to you, ORDER BY CHECKSUM(NEWID()) is better in that respect.

    Paul