Created
October 2, 2019 14:52
-
-
Save ElliottLandsborough/bb40db08e876a12864ee8f62840fe77c to your computer and use it in GitHub Desktop.
mysql.wat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chooses a set of random ids. This set does not contain a fixed number of elements but they are around 20 | |
$params = ['n' => $num_records, 'c' => $count, 'dc' => ($count * 2 < 20) ? 20 : $count * 2]; | |
$results = DB::connection('mysql.huge_table')->select('SELECT id FROM atoms_in_universe WHERE RAND() * :n < :dc ORDER BY RAND() LIMIT 0,:c', $params); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment