1👍
ORDER BY random()
LIMIT n
is a valid approach but slow because every single row in the table has to be considered.
This is still fast with 30 k rows, but with 30 M rows .. not so much.
I suggest this related questiion:
Best way to select random rows PostgreSQL
Source:stackexchange.com