From: Michael Fuhr <mike@fuhr.org>
To: Robert Creager <Robert_Creager@LogicalChaos.org>
Cc: PGPerformance <pgsql-performance@postgresql.org>
Subject: Re: Index isn't used during a join.
Date: Wed, 11 Jan 2006 02:00:08 -0700
Message-ID: <20060111090008.GA51672@winnie.fuhr.org> (raw)
In-Reply-To: <20060111075655.GA51292@winnie.fuhr.org>
References: <20060109212338.6420af12@thunder.logicalchaos.org>
<20060110055818.GA55076@winnie.fuhr.org>
<20060110221055.053596ab@thunder.logicalchaos.org>
<20060111075655.GA51292@winnie.fuhr.org>
On Wed, Jan 11, 2006 at 12:56:55AM -0700, Michael Fuhr wrote:
> WHERE ...
> AND doy >= EXTRACT(doy FROM now() - '24 hour'::interval)
> AND doy <= EXTRACT(doy FROM now())
To work on 1 Jan this should be more like
WHERE ...
AND (doy = EXTRACT(doy FROM now() - '24 hour'::interval) OR
doy = EXTRACT(doy FROM now()))
In any case the point is to add conditions to the WHERE clause that
will use an index on the table for which you're currently getting
a sequential scan.
--
Michael Fuhr
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: mike@fuhr.org, Robert_Creager@LogicalChaos.org
Subject: Re: Index isn't used during a join.
In-Reply-To: <20060111090008.GA51672@winnie.fuhr.org>
* 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