Re: Oddball data distribution giving me planner headaches

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Jeff Amiel'" <becauseimjeff(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Oddball data distribution giving me planner headaches
Date: 2011-12-02 20:38:12
Message-ID: 037b01ccb132$52062f80$f6128e80$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Jeff Amiel
Sent: Friday, December 02, 2011 3:20 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Oddball data distribution giving me planner headaches

explain analyze
select * from customer_rel where parent_customer in (select customer_id from customer where customer_type='DISTRIBUTOR')

" Nested Loop (cost=25429.44..29626.39 rows=931 width=0) (actual time=216.325..1238.091 rows=1025401 loops=1)"
" -> HashAggregate (cost=25429.44..25430.80 rows=136 width=4) (actual time=216.304..216.339 rows=68 loops=1)"
" -> Seq Scan on customer (cost=0.00..25429.10 rows=136 width=4) (actual time=0.018..216.226 rows=68 loops=1)"
" Filter: (customer_type = 'DISTRIBUTOR'::bpchar)"
" -> Index Scan using rel_parent on customer_rel (cost=0.00..30.76 rows=7 width=4) (actual time=0.006..8.190 rows=15079 loops=68)"
" Index Cond: (parent_customer = customer.customer_id)"
"Total runtime: 1514.810 ms"

------------------------------------------------------------

What kind of plan does the following give?

EXPLAIN ANALYZE
SELECT *
FROM customer_rel p
JOIN customer c ON (p.parent_customer = c.customer_id)
WHERE c.customer_type = 'DISTRIBUTOR'
;

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Amiel 2011-12-02 20:52:27 Re: Oddball data distribution giving me planner headaches
Previous Message Jeff Amiel 2011-12-02 20:19:39 Oddball data distribution giving me planner headaches