From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ravi Kiran <ravi(dot)kolanpaka(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Hash function constant in the Hash join algorithm |
Date: | 2015-05-07 18:49:28 |
Message-ID: | 26370.1431024568@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ravi Kiran <ravi(dot)kolanpaka(at)gmail(dot)com> writes:
> From the above two cases, I am understanding that even even when the hash
> function is made to return a constant, The hashjoin agorithm is taking
> significantly lower time compared to nested loop.
> Could anyone explain why does the hashjoin algorithm takes significantly
> lower time compared to nested loop when the hash function is made to return
> a constant value or have I done any mistake at any part of the code?
Well, hashjoin would suck the inner relation into memory (into its
hashtable) whereas nestloop would rescan the inner relation each time,
implying more buffer-access overhead, tuple visibility checking, etc.
A closer comparison might be to a nestloop that has a Materialize node
above its inner relation.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Rajiv M Ranganath | 2015-05-08 00:08:10 | Re: Any freeware graphic display of DDL software available? |
Previous Message | Ravi Kiran | 2015-05-07 18:46:22 | Hash function constant in the Hash join algorithm |