Re: Using IN with subselect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Smith <dave(dot)smith(at)candata(dot)com>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Using IN with subselect
Date: 2004-11-25 17:57:01
Message-ID: 796.1101405421@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave Smith <dave(dot)smith(at)candata(dot)com> writes:
> Well here is explain. I would guess that it is executed each time ..
> function any different?

> HashAggregate (cost=288.32..288.32 rows=1 width=32)
> -> Hash IN Join (cost=288.18..288.31 rows=1 width=32)
> -> Subquery Scan journal_all (cost=282.36..282.45 rows=2 width=64)
> -> Hash (cost=5.83..5.83 rows=1 width=13)
> -> Index Scan using glmast_index3 on glmast (cost=0.00..5.83 rows=1 width=13)

No ... this plan says to scan glmast once, load the selected rows into
an in-memory hash table, then scan journal_all once and probe the hash
table for matches. It looks like a pretty decent choice of plan to me.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-11-25 18:02:21 Re: How can I change a cast from explicit only to implicit?
Previous Message Martijn van Oosterhout 2004-11-25 17:25:46 Re: Using IN with subselect