Selecting random single row on large table
This assumes that id is your unique SERIAL field, and that {table}_id_seq is the field for the next value.
select * from {table}
where id >= (
select floor(random() * (
select last_value
from {table}_id_seq )) ) order by id asc limit 1
Categories: Postgresql