Accepted answer

Use row_number() to enumerate your rows in a subquery (or CTE), and then WHERE (rownum%240)=0. An example using a CTE:

original_query as (
SELECT timestamp, interest, yield FROM abc.public.table WHERE symbol='XTC' AND timestamp BETWEEN '2021-06-04 14:51:27.5127' AND '2021-06-11 14:51:27.5127' ORDER BY timestamp
numbered as (
select row_number() over () as rownum, oq from original_query oq
sampled as (
select (oq).* from numbered where (rownum%240)=0
select * from sampled;

Related Query

More Query from same tag