How to quickly get a random set of rows from a Postgres table!
In order to get random rows from a table, you can use the Postgres function TABLESAMPLE BERNOULLI,
percentages from 0 to 100 are accepted as arguments.
Database query example:
SELECT first_name FROM users TABLESAMPLE BERNOULLI(10)
TABLESAMPLE BERNOULLI is many times faster than order by random(), this can be useful if your table contains many millions of rows