From: Tom Lane <tgl@sss.pgh.pa.us>
To: matt@followers.net
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: What is the difference between these?
Date: Fri, 05 Nov 2004 15:32:28 -0500
Message-ID: <11491.1099686748@sss.pgh.pa.us> (raw)
In-Reply-To: <27c475ec0411051009460dd9d0@mail.gmail.com>
References: <27c475ec0411051009460dd9d0@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, matt@followers.net
Subject: Re: What is the difference between these?
In-Reply-To: <11491.1099686748@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox