Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL

From: Mischa Sandberg <mischa(dot)sandberg(at)telus(dot)net>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Christopher Petrilli <petrilli(at)gmail(dot)com>, Ying Lu <ying_lu(at)cs(dot)concordia(dot)ca>, pgsql-general(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL
Date: 2005-05-10 21:35:58
Message-ID: 1115760957.4281293e0155b@webmail.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

Quoting "Jim C. Nasby" <decibel(at)decibel(dot)org>:

> Well, in a hash-join right now you normally end up feeding at least
> one
> side of the join with a seqscan. Wouldn't it speed things up
> considerably if you could look up hashes in the hash index instead?

You might want to google on "grace hash" and "hybrid hash".

The PG hash join is the simplest possible: build a hash table in memory,
and match an input stream against it.

*Hybrid hash* is where you spill the hash to disk in a well-designed
way. Instead of thinking of it as building a hash table in memory, think
of it as partitioning one input; if some or all of it fits in memory,
all the better. The boundary condition is the same.

The real wizard of hybrid hash has to be Goetz Graefe, who sadly has now
joined the MS Borg. He demonstrated that for entire-table joins, hybrid
hash completely dominates sort-merge. MSSQL now uses what he developed
as an academic, but I don't know what the patent state is.

"Grace hash" is the original implementation of hybrid hash:
Kitsuregawa, M., Tanaka, H., and Moto-oka, T. (1984).
Architecture and Performance of Relational Algebra Machine Grace.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2005-05-10 21:45:23 Re: Delphi - Developers start develop Access components
Previous Message Christopher Murtagh 2005-05-10 21:31:56 Re: Trigger that spawns forked process

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2005-05-10 21:40:24 Re: PGSQL Capacity
Previous Message Mohan, Ross 2005-05-10 21:28:23 Re: Prefetch - OffTopic