Re: two table join just not fast enough.

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

 



On 03/11/11 09:12, Brian Fehrle wrote:


And here is a query plan.

Hash Join (cost=17516.470..26386.660 rows=27624 width=4) (actual time=309.194..395.135 rows=12384 loops=1)
    Hash Cond: (yankee.alpha = hotel_zulu.quebec)
-> Bitmap Heap Scan on yankee (cost=1066.470..8605.770 rows=27624 width=20) (actual time=5.178..34.693 rows=26963 loops=1)
          Recheck Cond: (mike = 402513)
-> Bitmap Index Scan on hotel_alpha (cost=0.000..1059.570 rows=27624 width=0) (actual time=4.770..4.770 rows=26967 loops=1)
                Index Cond: (mike = 402513)
-> Hash (cost=14465.080..14465.080 rows=114154 width=16) (actual time=303.717..303.717 rows=129908 loops=1)
          Buckets: 4096  Batches: 8  Memory Usage: 784kB
-> Bitmap Heap Scan on hotel_zulu (cost=2461.770..14465.080 rows=114154 width=16) (actual time=25.642..185.253 rows=129908 loops=1)
                Recheck Cond: ((two)::golf = ANY ('xray'::golf[]))
-> Bitmap Index Scan on kilo (cost=0.000..2433.230 rows=114154 width=0) (actual time=23.887..23.887 rows=130292 loops=1)
                      Index Cond: ((two)::golf = ANY ('xray'::golf[]))


Might be worth posting table definitions, as this plan does not immediately look like it came from the query you posted. Also unless I am misreading the output looks like you have some custom datatypes (e.g 'golf'), so more info there could be useful too.

When we have that, there may be something to be learned from examining the pg_stats data for the join and predicate columns used in these queries.

regards

Mark

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


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux