query optimization Anyone know a better way to run this query

From: "David Blood" <davidjblood(at)yahoo(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: query optimization Anyone know a better way to run this query
Date: 2002-02-21 00:57:08
Message-ID: 005b01c1ba72$b0a0f0a0$0100a8c0@david2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Anyone know a better way to run this query to make it faster.
It is running on a a dual 800 pIII with 1gig ram.



SET ENABLE_SEQSCAN TO OFF;
Explain
select
(loginFName|| ' ' || loginLName) as Name,
loginID as PFLID,
count(1) as NumberOfLeads
from
tbllogin,
tblcold
where
coldsponsorid = tbllogin.loginid
group by
loginID,
loginFName,
LoginLName
order by
name
limit
0

QUERY PLAN:
Limit (cost=1453435.17..1453435.17 rows=1 width=32)
-> Sort (cost=1453435.17..1453435.17 rows=242562 width=32)
-> Aggregate (cost=1407484.24..1431740.44 rows=242562 width=32)
-> Group (cost=1407484.24..1425676.39 rows=2425620
width=32)
-> Sort (cost=1407484.24..1407484.24 rows=2425620
width=32)
-> Merge Join (cost=0.00..1070338.18
rows=2425620 width=32)
-> Index Scan using tbllogin_pkey on
tbllogin (cost=0.00..465.90 rows=2658 width=28)
-> Index Scan using spons_tblcold_index
on tblcold (cost=0.00..1039518.81 rows=2425620 width=4)

Browse pgsql-general by date

  From Date Subject
Next Message Barry Lind 2002-02-21 01:02:13 Re: returning rows from a function
Previous Message corey 2002-02-21 00:56:33 libpq++ problem