On Tue, Nov 10, 2020, 3:24 PM Peter Coppens <peter.copp...@datylon.com> wrote:
> Index is not used for the subquery > > explain > select mv_inner.* > from measurement_value AS mv_inner > where mv_inner.timestamp > '2020-11-06'::timestamp - interval '1 day' > and mv_inner.timestamp < '2020-11-07'::timestamp + interval '1 day' > offset 0 > > ==> > > Seq Scan on measurement_value mv_inner (cost=0.00..7175777.00 rows=1219616 > width=1006) > Filter: (("timestamp" > '2020-11-05 00:00:00'::timestamp without time > zone) AND ("timestamp" < '2020-11-08 00:00:00'::timestamp without time > zone)) > Curious, how accurate is that row count of 1.2 million records for 3 days? How many total records in the table? If you disable sequential scan, does it choose the index and what cost does it show?