explain, planner and more..

From: Svenne Krap <usenet(at)krap(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: explain, planner and more..
Date: 2001-08-14 22:03:41
Message-ID: vj7jntk2eeahirm9l9pg4d4n1v9bj4ic19@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

how has the following to be read.. (ie. what is the total cost of the
query)... 4.05, 5.88 or ?

Why does the planner choose not to use numberdomain_pkey as index on
numberdomain ?

The table layout is quite bad (due to a lot of last minute-changes)

<snip>
# explain select c.*, (select count(*) from numberservice ns where
ns.customerid=c.customerid and (exists (select * from numbermail nm
where nm.domainnr = ns.domainnr) or exists(select * from numberdomain
nd where nd.domainnr=ns.domainnr))) as amount from customer c where
c.status=0;
NOTICE: QUERY PLAN:

Seq Scan on customer c (cost=0.00..4.05 rows=46 width=200)
SubPlan
-> Aggregate (cost=5.88..5.88 rows=1 width=0)
-> Index Scan using numberservice_customerid_ix on
numberservice ns (cost=0.00..5.88 rows=1 width=0)
SubPlan
-> Index Scan using numbermail_pkey on numbermail
nm (cost=0.00..2.01 rows=1 width=47)
-> Seq Scan on numberdomain nd (cost=0.00..1.85
rows=1 width=31)

EXPLAIN
--
Mail usenet(at)krap(dot)dk - svenne(at)krap(dot)dk - PGP key id : 0xDF484022
ICQ: 5434480 - http://www.krap.dk - http://www.krap.net
PGP Key http://keys.pgp.dk:11371/pks/lookup?op=get&search=0xDF484022

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ryan Mahoney 2001-08-14 22:17:12 Re: DeadLocks
Previous Message Peter Eisentraut 2001-08-14 21:35:55 Re: cmd-line interface