Re: Timestamp indexes (why ">" or "between" does not use index?)

Поиск
Список
Период
Сортировка
От Phoenix Kiula
Тема Re: Timestamp indexes (why ">" or "between" does not use index?)
Дата
Msg-id e373d31e0802160813s78d7534ds71fa6336ba451339@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Timestamp indexes (why ">" or "between" does not use index?)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Timestamp indexes (why ">" or "between" does not use index?)
Список pgsql-general
This table is vacuumed and analyzed every hour, so yes, it's been
analyzed recently.

These are the EXPLAIN ANALYZE outputs for both the equality condition
and the greater than condition:


orguser=# explain analyze select alias from clientswhere modify_date =
'2008-01-01' ;
                                                        QUERY PLAN

-----------------------------------------------------------------------------------------------------------------------------
 Index Scan using new_idx_modify_date on clients (cost=0.00..30.23
rows=8 width=10) (actual time=0.136..0.136 rows=0 loops=1)
  Index Cond: (modify_date = '2008-01-01 00:00:00'::timestamp without
time zone)
 Total runtime: 0.220 ms
(3 rows)

Time: 2.832 ms


orguser=# explain analyze select alias from clientswhere modify_date >
'2008-01-01' ;
                                                   QUERY PLAN
------------------------------------------------------------------------------------------------------------------
 Seq Scan on clients (cost=0.00..237043.09 rows=136617 width=10)
(actual time=0.391..4007.188 rows=148225 loops=1)
  Filter: (modify_date > '2008-01-01 00:00:00'::timestamp without time zone)
 Total runtime: 4539.242 ms
(3 rows)

Time: 4539.850 ms



Welcome any thoughts. Thanks!

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Strict-typing benefits/costs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: SELECT CAST(123 AS char) -> 1