Quoting Tom Lane <tgl@sss.pgh.pa.us>:
> Mischa Sandberg <mischa.sandberg@telus.net> writes:
> > The PG hash join is the simplest possible: build a hash table in
> memory, and match an input stream against it.
>
> [ raised eyebrow... ] Apparently you've not read the code. It's
> been hybrid hashjoin since we got it from Berkeley. Probably not the
> best possible implementation of the concept, but we do
> understand about spill to disk.
Apologies. I stopped reading around line 750 (PG 8.0.1) in
src/backend/executor/nodeHashjoin.c
if (!node->hj_hashdone)
{
....
/*
* execute the Hash node, to build the hash table
*/
hashNode->hashtable = hashtable;
(void) ExecProcNode((PlanState *) hashNode);
...
and missed the comment:
/*
* Open temp files for outer batches,
*/
Will quietly go and read twice, talk once.