Re: Hash Join not using hashed index? - Mailing list pgsql-sql

From Tom Lane
Subject Re: Hash Join not using hashed index?
Date
Msg-id 14589.962175604@sss.pgh.pa.us
Whole thread Raw
In response to Hash Join not using hashed index?  (Ang Chin Han <angch@pintoo.com>)
Responses Re: Hash Join not using hashed index?  (Ang Chin Han <angch@pollcities.com>)
List pgsql-sql
Hash joins don't have anything to do with hash indexes.

A hash join is a join that makes use of a temporary hashtable
built on-the-fly *in memory* for that join.

The planner could choose to use an indexscan on a hash index
as an input for the join, but it'd only be likely to do so
if there is a restriction clause matching the index.  In your
example you have only a join WHERE clause.

Plain btree indexes on city.country_id and country.country_id
might work better --- at least they'd offer the option of
a merge join without doing explicit sort.
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problem with pg_dumpall
Next
From: Ben Stringer
Date:
Subject: Selecting outside the current DB