Re: Execution plan does not use index

Поиск
Список
Период
Сортировка
От Michael Lewis
Тема Re: Execution plan does not use index
Дата
Msg-id CAHOFxGoxE_rEOMRzFvm9RyO5yOx+y5CT3Rn+OWqwWKTB=RWT7g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Execution plan does not use index  (Peter Coppens <peter.coppens@datylon.com>)
Ответы Re: Execution plan does not use index  (Peter Coppens <peter.coppens@datylon.com>)
Список pgsql-general
On Tue, Nov 10, 2020, 3:24 PM Peter Coppens <peter.coppens@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?

В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Coppens
Дата:
Сообщение: Re: Execution plan does not use index
Следующее
От: Peter Coppens
Дата:
Сообщение: Re: Execution plan does not use index