Re: Best way to select a random row from a derived table

2018-01-28 Thread Condor
On 28-01-2018 08:39, Ryan Murphy wrote: Hello hackers and postgressers, I am aware of 2 ways to select a random row from a table: 1) select * from table_name order by random() limit 1; -- terribly inefficient 2) select * from table_name tablesample system_rows(1) limit 1;

Re: Best way to select a random row from a derived table

2018-01-28 Thread Fabien COELHO
I am aware of 2 ways to select a random row from a table: 1) select * from table_name order by random() limit 1; -- terribly inefficient 2) select * from table_name tablesample system_rows(1) limit 1; -- only works on tables, not views or subqueries Is there an option that

Best way to select a random row from a derived table

2018-01-27 Thread Ryan Murphy
Hello hackers and postgressers, I am aware of 2 ways to select a random row from a table: 1) select * from table_name order by random() limit 1; -- terribly inefficient 2) select * from table_name tablesample system_rows(1) limit 1; -- only works on tables, not views or s