Time_bucket_gapfill How to define the range of a week

225 views Asked by At

I have a time_bucket_gapfill problem with timescaledb. When I set an initial value, I want to query data from 7 days after this day, but timescaledb always starts counting from Monday. How can I customize the range of seven days?

This is my code

   SELECT 
time_bucket_gapfill('7 day', time,
                   start =>'2016-01-02',finish => '2016-12-31') AS "day", 
locf(sum(pub_flg)) as pub_flg
    FROM public.tb_lp_media_pub
    where media_id=3236
    GROUP BY "day"
    ORDER BY "day" asc;

This is my result

This is real weeks

This is the result of adding the where condition

This is my table structure with some data

0

There are 0 answers