Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux