Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // chooses a set of random ids. This set does not contain a fixed number of elements but they are around 20
  2. $params = ['n' => $num_records, 'c' => $count, 'dc' => ($count * 2 < 20) ? 20 : $count * 2];
  3. $results = DB::connection('mysql.huge_table')->select('SELECT id FROM atoms_in_universe WHERE RAND() * :n < :dc ORDER BY RAND() LIMIT 0,:c', $params);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement