Fill Missing Dates by Generating Series of Timestamps

I was struggling with how to generate missing timesteps so that data is sorted correctly by date when there are 2 series (I was attempting to overlay week-long periods from two different months). If you ever need to pad or fill missing timestamps, you can modify the below code, which is set up for 15 minute intervals. 

with buckets AS (
    select (dateadd(minute, 15*-row_number() over (order by true), sysdate::date)) as minute 
    from devices limit 1440
select minute from buckets order by 1 asc

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like3 Follow
  • 8 mths agoLast active
  • 165Views
  • 1 Following