pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
To: Brian Fehrle <brianf@consistentstate.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: two table join just not fast enough.
Date: Thu, 03 Nov 2011 14:47:59 +1300
Message-ID: <4EB1F2CF.9030304@catalyst.net.nz> (raw)
In-Reply-To: <4EB1A419.1080901@consistentstate.com>
References: <4EB1A419.1080901@consistentstate.com>

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



view thread (4+ messages)

Message-ID: <4EB1F2CF.9030304@catalyst.net.nz>
Permalink:  ../4EB1F2CF.9030304@catalyst.net.nz/
Also on:    postgresql.org/message-id/4EB1F2CF.9030304@catalyst.net.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mark.kirkwood@catalyst.net.nz, brianf@consistentstate.com
  Subject: Re: two table join just not fast enough.
  In-Reply-To: <4EB1F2CF.9030304@catalyst.net.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox