Time_bucket_gapfill如何定义一周的范围

时间:2019-11-14 02:48:51

标签: timescaledb

我的timescaledb有一个time_bucket_gapfill问题。设置初始值时,我想查询这一天之后7天的数据,但是timescaledb总是从星期一开始计数。如何自定义7天的时间范围?

这是我的代码

   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 个答案:

没有答案