Created
August 8, 2016 14:14
-
-
Save bitdivine/409723a34a15bcd4cd0aa7d6816c7709 to your computer and use it in GitHub Desktop.
Fast select random row from a Postgres table.
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
| select * from MY_TABLE offset random()*(select count(*) from MY_TABLE) limit 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment