Re: What is the difference between these? - Mailing list pgsql-performance

From Tom Lane
Subject Re: What is the difference between these?
Date
Msg-id 11491.1099686748@sss.pgh.pa.us
Whole thread Raw
In response to What is the difference between these?  (Matt Nuzum <matt.followers@gmail.com>)
List pgsql-performance
Matt Nuzum <matt.followers@gmail.com> writes:
> To me, these three queries seem identical... why doesn't the first one
> (simplest to understand and write) go the same speed as the third one?

This is the standard problem that the planner has to guess about the
selectivity of inequalities involving non-constants (like now()).
The guesses are set up so that a one-sided inequality will use a
seqscan while a range constraint will use an indexscan.

See the pgsql-performance archives for other ways of persuading it
that an indexscan is a good idea.

            regards, tom lane

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange (?) Index behavior?
Next
From: Allen Landsidel
Date:
Subject: Re: Strange (?) Index behavior?