I have a QuestDB table in which I get a few records every second. I am aggregating in 1 minute intervals, as in
select timestamp, symbol, avg(price) as price from trades
where timestamp in yesterday() and side="buy" sample by 1m
Now I would like to get, for every sampled row, which was the minimum value for the rows with the same symbol within the past 5 minutes.
I tried using window functions, but QuestDB doesn’t support yet the min
function as a window function. Otherwise I could do something like:
select timestamp, symbol, avg(price) as price,
min(avg(price)) over (partition by symbol range 5 minutes preceding) as min_price from trades
where timestamp in yesterday() and side="buy" sample by 1m
Are there any workarounds for this, or do I need to implement client-side?
You need to sign in to view this answers
Leave feedback about this