X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A09852A55 for ; Tue, 9 Aug 2005 09:16:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47906-04 for ; Tue, 9 Aug 2005 12:15:56 +0000 (GMT) Received: from mailhost.intellivid.com (mailhost.intellivid.com [64.32.200.11]) by svr1.postgresql.org (Postfix) with ESMTP id 32B3252A03 for ; Tue, 9 Aug 2005 09:15:53 -0300 (ADT) Received: from [192.168.2.68] (spectre.intellivid.com [192.168.2.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by newmail.intellivid.com (Postfix) with ESMTP id 9F268F182AE; Tue, 9 Aug 2005 08:15:56 -0400 (EDT) Subject: Re: Why hash join instead of nested loop? From: Ian Westmacott To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <10930.1123549106@sss.pgh.pa.us> References: <41b0fe890508051135712a086b@mail.gmail.com> <001801c59a0a$f4be7480$9a00a8c0@OTTO> <41b0fe8905080516164464e04f@mail.gmail.com> <15425.1123304631@sss.pgh.pa.us> <41b0fe89050808100021a2a4fc@mail.gmail.com> <10930.1123549106@sss.pgh.pa.us> Content-Type: text/plain Organization: Intellivid Corp. Message-Id: <1123589756.15206.4.camel@spectre.intellivid.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 09 Aug 2005 08:15:56 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200508/76 X-Sequence-Number: 13823 On Mon, 2005-08-08 at 20:58, Tom Lane wrote: > I'd be interested to see results from other people using 7.4.* too. 7.4.8: QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=4.83..5.91 rows=1 width=14) (actual time=0.122..0.126 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.003..0.006 rows=5 loops=1) -> Hash (cost=4.83..4.83 rows=1 width=4) (actual time=0.021..0.021 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.013..0.015 rows=1 loops=1) Index Cond: ((connection_registry_id = 40105) AND (obj1 = 73582)) Total runtime: 0.198 ms 7.4.2: QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=4.83..5.91 rows=1 width=14) (actual time=0.577..0.600 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.006..0.023 rows=5 loops=1) -> Hash (cost=4.83..4.83 rows=1 width=4) (actual time=0.032..0.032 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.016..0.020 rows=1 loops=1) Index Cond: ((connection_registry_id = 40105) AND (obj1 = 73582)) Total runtime: 0.697 ms --Ian