From: Greg Stark <gsstark@mit.edu>
To: Shea,Dan [CIS] <Dan.Shea@ec.gc.ca>
Cc: pgsql-performance@postgresql.org
Subject: Re: database performance and query performance question
Date: 22 Jan 2004 19:20:25 -0500
Message-ID: <874qunzfau.fsf@stark.xeocode.com> (raw)
In-Reply-To: <F2D63B916C88C14D9B59F93C2A5DD33F0B9117@cisxa.cis.ec.gc.ca>
References: <F2D63B916C88C14D9B59F93C2A5DD33F0B9117@cisxa.cis.ec.gc.ca>
"Shea,Dan [CIS]" <Dan.Shea@ec.gc.ca> writes:
> Indexes:
> "forecastelement_vrwi_idx" btree (valid_time,region_id.wx_element.issue_time)
>
> explain analyze
> SELECT DISTINCT ON (valid_time)
> to_char(valid_time,'YYYYMMDDHH24MISS') AS valid_time,
> value
> from (
> SELECT valid_time,value, "time"(valid_time) AS hour, reception_time, issue_time
> FROM forecastelement
> WHERE valid_time BETWEEN '2002-09-02 04:00:00' AND '2002-09-07 03:59:59'
> AND region_id = 'PU-REG-WTO-00200'
> AND wx_element = 'TEMP_VALEUR1'
> AND issue_time BETWEEN '2002-09-02 05:00:00' AND '2002-09-06 05:00:00'
> AND origin = 'REGIONAL'
> AND "time"(issue_time) = '05:00:00'
> ORDER BY issue_time,reception_time DESC,valid_time
> ) AS foo
> WHERE
> ( date(valid_time) = date(issue_time)+1 -1
> OR date(valid_time) = date(issue_time)+1
> OR ( valid_time BETWEEN '2002-09-07 00:00:00' AND '2002-09-07 03:59:59'
> AND issue_time = '2002-09-06 05:00:00'
> )
> )
> ORDER BY valid_time ,issue_time DESC;
Incidentally, I find it easier to analyze queries when they've been formatted
well. This makes what's going on much clearer.
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: gsstark@mit.edu, Dan.Shea@ec.gc.ca
Subject: Re: database performance and query performance question
In-Reply-To: <874qunzfau.fsf@stark.xeocode.com>
* 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