Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
1 answer
5k views

order by random meaning (postgresql)

One possible way to select random rows in PostgreSQL is this: select * from table order by random() limit 1000; (see also here.) My question is, what does order by random() mean exactly? Is it that ...
Attilio's user avatar
  • 151
9 votes
5 answers
10k views

Get a truly RANDOM row from a PostgreSQL table quickly

I always used to do: SELECT column FROM table ORDER BY random() LIMIT 1; For large tables, this was unbearably, impossibly slow, to the point of being useless in practice. That's why I started ...
user avatar
2 votes
1 answer
201 views

Recommended Database(s) for Selecting Random Rows

I'm familiar with selecting random rows from a table in PostgreSQL. It's really slow. I've looked into some other databases and they all seem to be bad at it. Mostly because it's not a normal use case ...
Jason Champion's user avatar