From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO] <robert.m.hartranft@nasa.gov>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: question on hash joins
Date: Thu, 19 Oct 2017 10:14:09 -0400
Message-ID: <30523.1508422449@sss.pgh.pa.us> (raw)
In-Reply-To: <B4DE522C-7B7B-47DC-9143-B3087A7487D5@nasa.gov>
References: <60286BB5-0A38-42C8-A673-5289CA6D2354@nasa.gov>
<63F14C4C-1518-4EAA-9EBE-87222988F073@nasa.gov>
<22675.1508361426@sss.pgh.pa.us>
<B4DE522C-7B7B-47DC-9143-B3087A7487D5@nasa.gov>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>
"Hartranft, Robert M. (GSFC-423.0)[RAYTHEON CO]" <robert.m.hartranft@nasa.gov> writes:
> Sorry if I am being dense, but I still have a question…
> Is it possible for me to estimate the size of the hash and a value for
> the temp_file_limit setting using information in the explain plan?
Well, it'd be (row_overhead + data_width) * number_of_rows.
Poking around in the source code, it looks like the row_overhead in
a tuplestore temp file is 10 bytes (can be more if you have nulls in
the data). Your example seemed to be storing one bigint column,
so data_width is 8 bytes. data_width can be a fairly squishy thing
to estimate if the data being passed through the join involves variable-
width columns, but the planner's number is usually an OK place to start.
> For example, one possibility is that the hash contains the entire tuple for each
> matching row.
No, it's just the columns that need to be used in or passed through the
join. If you want to be clear about this you can use EXPLAIN VERBOSE
and check what columns are emitted by the plan node just below the hash.
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, robert.m.hartranft@nasa.gov
Subject: Re: question on hash joins
In-Reply-To: <30523.1508422449@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox