$count = จำนวนเรคคอร์ด; // 1
$ar=array();
for($i=1; $i<$count; $i+=10) $ar[]=rand($i,($i+9>$count ? $count : $i+9)); // 2
$sql='select *
from (select row_number() over (order by keyfield ) as row,* from tablename ) as t
where row in ('.implode(',', $ar).')'; // 3