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@krap.dk - svenne@krap.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