Re: Queries with timestamp II

Поиск
Список
Период
Сортировка
От Shridhar Daithankar
Тема Re: Queries with timestamp II
Дата
Msg-id 40152655.6080605@frodo.hserus.net
обсуждение исходный текст
Ответ на Queries with timestamp II  ("Arnau" <arnaulist@andromeiberica.com>)
Список pgsql-performance
Arnau wrote:

> explain analyze select * from statistics2 where timestamp_in <
> to_timestamp( '20031201', 'YYYYMMDD' );
> NOTICE:  QUERY PLAN:
>
> Seq Scan on statistics2  (cost=0.00..638.00 rows=9289 width=35) (actual
> time=0.41..688.34 rows=27867 loops=1)
> Total runtime: 730.82 msec
>
> That query is not using the index. Anybody knows what I'm doing wrong?

Since it expects large number of rows will be returned, it is favouring
sequential scan.

Given how the estimates have differed, i.e. estimated 9289 v/s actual 27867, I
sugest you up the statistics for the table using alter table. Check
http://www.postgresql.org/docs/current/static/sql-altertable.html


HTH

  Shridhar

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

Предыдущее
От: Randolf Richardson
Дата:
Сообщение: Re: Persistent Connections
Следующее
От: "Loeke"
Дата:
Сообщение: views?