I am trying to speed up a random selection query in Oracle and found this blog. I am not able to convert their following Postgres queries in oracle:
select * from users
where
random() < 200 / (select count(1) from logs)::float
order by random()
limit 100;
and
select * from users
where id in (
select round(random() * 21e6)::integer as id
from generate_series(1, 110)
group by id -- Discard duplicates
)
limit 100;
How would this queries look like in oracle?
FETCH FIRSTinstead ofLIMIT. And I supposeCASTinstead of::.tablesampleto sample rows from a table?