Most efficient way to return a random specific sample size in sql / coldfusion -


i need return values based on sample size. if user selects 5% query resulting in random 5% of rows origonal query. there way can achieve sql?

currently process run query generate random numbers remove rows until 5% left, build new query off rows left. not believe efficient way, better ideas?

thanks

what end? support out of box, eg. sql server limiting result sets using tablesample:

select firstname, lastname person.person  tablesample (5 percent) ; 

in system should try filter on server, not on client. eg. use mysqls crc32 compute row checksum , use checksum qualify 5% rows. or use rand() similar effect. whatever do, don't fetch entire table , filter rows on client.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -