0

Say I have a table that is a million rows and say 20 columns (assume no LOB columns) and I want to get a quick profile of the data (selectivity, density, distribution etc). I can probably get a good idea from 50,000 randomly selected rows instead of initially trawling through the whole table. Is there a faster way than TOP X ... ORDER BY NEWID()?

DatumPoint
  • 419
  • 4
  • 21
  • 1
    Possible duplicate of [Select random sampling from sqlserver quickly](http://stackoverflow.com/questions/652064/select-random-sampling-from-sqlserver-quickly) – Sean Lange Apr 21 '16 at 16:35
  • Good pickup. Thanks Sean. I guess that given the original question is seven years old now, has anything changed in the interim? – DatumPoint Apr 21 '16 at 16:45
  • Not really. It still just gets a sample of pages instead of creating a million guids. If this is for analysis I would consider using TABLESAMPLE as part of an insert into another table so you don't keep tying up the main table. – Sean Lange Apr 21 '16 at 16:52

0 Answers0