Re: [HACKERS] please help on query

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: "Luis Alberto Amigo Navarro" <lamigo(at)atc(dot)unican(dot)es>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [HACKERS] please help on query
Date: 2002-07-17 13:28:37
Message-ID: 20020717215801.79DF.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On Tue, 16 Jul 2002 10:51:03 +0200
"Luis Alberto Amigo Navarro" <lamigo(at)atc(dot)unican(dot)es> wrote:

> Aggregate (cost=1257368.92..1287375.04 rows=600122 width=12) (actual
> time=1236941.71..1454824.56 rows=62 loops=1)
> -> Group (cost=1257368.92..1272371.98 rows=6001225 width=12) (actual
> time=1233968.87..1385034.91 rows=6001225 loops=1)
> -> Sort (cost=1257368.92..1257368.92 rows=6001225 width=12)
> (actual time=1233968.82..1276147.37 rows=6001225 loops=1)
> -> Hash Join (cost=166395.00..520604.08 rows=6001225
> width=12) (actual time=59061.21..773997.08 rows=6001225 loops=1)
> -> Seq Scan on lineitem (cost=0.00..195405.25
> rows=6001225 width=8) (actual time=20.66..115511.34 rows=6001225 loops=1)
> -> Hash (cost=162645.00..162645.00 rows=1500000
> width=4) (actual time=59032.16..59032.16 rows=0 loops=1)
> -> Seq Scan on orders (cost=0.00..162645.00
> rows=1500000 width=4) (actual time=17.33..44420.10 rows=1500000 loops=1)
> Total runtime: 1454929.11 msec

Hmm, does each of the three tables have some indices like the following?
If not so, could you execute EXPLAIN ANALYZE after creating the indices.

create index idx_lineitem_orderkey on lineitem(orderkey);
create index idx_orders_orderkey on orders(orderkey);
create index idx_orders_custkey on orders(custkey);
create index idx_customer_custkey on customer(custkey);

Regards,
Masaru Sugawara

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-07-17 15:17:47 Re: ELOGs doubled up
Previous Message Robert Kernell 2002-07-17 12:38:04 need assignment

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah. 2002-07-17 15:10:28 Re: How to find out if an index is unique?
Previous Message Bruno Wolff III 2002-07-17 12:06:46 Re: Indexing UNIONs