From: Hannu Krosing <hannu@tm.ee>
To: Luis Alberto Amigo Navarro <lamigo@atc.unican.es>
Cc: pgsql-hackers@postgresql.org
Subject: Re: please help on query
Date: 11 Jul 2002 23:08:15 +0200
Message-ID: <1026421695.18194.24.camel@taru.tm.ee> (raw)
In-Reply-To: <005e01c228ee$bd1913e0$cab990c1@atc.unican.es>
References: <005e01c228ee$bd1913e0$cab990c1@atc.unican.es>
On Thu, 2002-07-11 at 17:22, Luis Alberto Amigo Navarro wrote:
> I can't improve performance on this query:
This _may_ work.
SELECT
supplier.name,
supplier.address
FROM
supplier,
nation,
WHERE supplier.suppkey IN (
SELECT part.partkey
FROM part
WHERE part.name like 'forest%'
INNER JOIN partsupp ON part.partkey=partsupp.partkey
INNER JOIN (
SELECT 0.5*(sum(lineitem.quantity)::FLOAT) as halfsum
FROM lineitem
WHERE lineitem.partkey=partsupp.partkey
AND shipdate >= '1994-01-01'
AND shipdate < '1995-01-01'
) li ON partsupp.availqty > halfsum
)
AND supplier.nationkey=nation.nationkey
AND nation.name='CANADA'
ORDER BY supplier.name;
---------------
Hannu
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-sql@postgresql.org
Cc: hannu@tm.ee, lamigo@atc.unican.es, pgsql-hackers@postgresql.org
Subject: Re: please help on query
In-Reply-To: <1026421695.18194.24.camel@taru.tm.ee>
* 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