Hi everyone,
I am facing a performance problem with selecting a random row from a table.
I do it like this:
SELECT * FROM table ORDER BY random() LIMIT 1
But it seems that the random() function is quite slow and backend apparently
evaluates the function for all rows (which is logical). On a table with few
thousand rows it takes seconds. Does anybody know a better solution to
selecting one (or more) random rows from a table ?
Thanks for any ideas,
Michal