Re: [ADMIN] question on hash joins - Mailing list pgsql-admin

From Tom Lane
Subject Re: [ADMIN] question on hash joins
Date
Msg-id 24789.1508429713@sss.pgh.pa.us
Whole thread Raw
In response to Re: [ADMIN] question on hash joins  ("Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO]"<robert.m.hartranft@nasa.gov>)
List pgsql-admin
"Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO]" <robert.m.hartranft@nasa.gov> writes:
> Given that the hash would only contain keys and values needed for supporting
> the query I am having a hard time understanding why I am exceeding the
> 10 GB temp_file_limit.

Because *both sides* of the join are getting dumped to temp files.
This is necessary when the hash requires multiple batches.  All
but the first batch of hash keys get written out to files, and then
we reload each batch of the inner relation into the in-memory table
and scan the corresponding batch file from the outer relation.

If you can make work_mem large enough to hold the inner relation
then the problem should go away.  Note though that the per-row
overhead is significantly larger in the in-memory representation;
don't have an estimate for that offhand.
        regards, tom lane


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

pgsql-admin by date:

Previous
From: "Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO]"
Date:
Subject: Re: [ADMIN] question on hash joins
Next
From: Chris Kim
Date:
Subject: [ADMIN] WAL segement issues on both master and slave server