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]

 



Michael Glaesemann <grzm@xxxxxxxxxxxxxxx> writes:
> The planner will choose a seq scan if it thinks that it will be  
> faster than using an index: if based on its statistics it thinks a  
> large portion of rows will match the criteria, a seq scan may well be  
> faster than an index scan.

> Have you analyzed recently?

If you've never analyzed at all, the default assumptions will
discourage the planner from using an indexscan for a one-sided
inequality condition (like "x > constant").  On the other hand,
it usually will use an indexscan for a range inequality (like
"x > constant1 and x < constant2", or a BETWEEN construct).

If you do have ANALYZE stats then it all depends on what fraction of
the column's range is selected by the inequality or range condition.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[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