Re: Execution plan does not use index

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Peter Coppens <peter(dot)coppens(at)datylon(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Execution plan does not use index
Date: 2020-11-11 00:43:55
Message-ID: CAHOFxGoxE_rEOMRzFvm9RyO5yOx+y5CT3Rn+OWqwWKTB=RWT7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 10, 2020, 3:24 PM Peter Coppens <peter(dot)coppens(at)datylon(dot)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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Coppens 2020-11-11 05:51:36 Re: Execution plan does not use index
Previous Message Peter Coppens 2020-11-10 22:23:59 Re: Execution plan does not use index