From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim C. Nasby <jim@nasby.net>
Cc: pgsql-performance@postgreSQL.org
Subject: Re: Horribly slow hash join
Date: Sat, 17 Apr 2004 12:08:15 -0400
Message-ID: <10603.1082218095@sss.pgh.pa.us> (raw)
In-Reply-To: <20040416184541.GK87362@nasby.net>
References: <20040416154502.GF87362@nasby.net>
<450.1082133251@sss.pgh.pa.us>
<20040416164644.GH87362@nasby.net>
<808.1082135098@sss.pgh.pa.us>
<20040416172523.GJ87362@nasby.net>
<1263.1082138383@sss.pgh.pa.us>
<20040416184541.GK87362@nasby.net>
[ resending because I fat-fingered the cc: to the list ]
I see the problem: all the entries in your work_units column have the
low 32 bits equal to zero.
regression=# select distinct work_units % (2^32)::bigint from Trank_work_overall;
?column?
----------
0
(1 row)
The hash function for int8 only takes the low word into account, so all
of the entries end up on the same hash chain, resulting in worst-case
behavior. This applies to both your hash join and hash aggregate cases.
We could change the hash function, perhaps, but then we'd just have
different cases where there's a problem ... hashing will always fail on
*some* set of inputs. (Also, I have been harboring some notions of
supporting cross-type hash joins for integer types, which will not work
unless small int8 values hash the same as int4 etc.)
I guess the real issue is why are you encoding work_units like that?
regards, tom lane
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-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, jim@nasby.net
Subject: Re: Horribly slow hash join
In-Reply-To: <10603.1082218095@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