Search Postgresql Archives

Re: Oddball data distribution giving me planner headaches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Jeff Amiel
Sent: Friday, December 02, 2011 3:20 PM
To: pgsql-general@xxxxxxxxxxxxxx
Subject:  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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux