Re: Why hash join instead of nested loop?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rhett Garber <rhettg(at)gmail(dot)com>, Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Why hash join instead of nested loop?
Date: 2005-08-09 05:11:48
Message-ID: 20050809051148.GA85494@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, Aug 08, 2005 at 08:58:26PM -0400, Tom Lane wrote:
> I'd be interested to see results from other people using 7.4.* too.

I just built 7.4.1 on FreeBSD 4.11-STABLE and ran your test:

test=# explain analyze select rtmessagestate.* from rtmessagestate,connection where (connection_registry_id = 40105) AND (obj1 = 73582) and id = obj2;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------
Hash Join (cost=4.83..5.91 rows=1 width=14) (actual time=0.220..0.264 rows=1 loops=1)
Hash Cond: ("outer".id = "inner".obj2)
-> Seq Scan on rtmessagestate (cost=0.00..1.05 rows=5 width=14) (actual time=0.015..0.050 rows=5 loops=1)
-> Hash (cost=4.83..4.83 rows=1 width=4) (actual time=0.103..0.103 rows=0 loops=1)
-> Index Scan using connection_regid_obj1_index on connection (cost=0.00..4.83 rows=1 width=4) (actual time=0.070..0.081 rows=1 loops=1)
Index Cond: ((connection_registry_id = 40105) AND (obj1 = 73582))
Total runtime: 0.495 ms
(7 rows)

--
Michael Fuhr

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ian Westmacott 2005-08-09 12:15:56 Re: Why hash join instead of nested loop?
Previous Message Mark Kirkwood 2005-08-09 05:05:39 Re: QRY seems not using indexes