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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, 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 06:12:17
Message-ID: 878y2nsj7i.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> However: what about storing the things in hashcode order? Ordering uint32s
> doesn't seem like any big conceptual problem.
>
> I think that efficient implementation of this would require explicitly
> storing the hash code for each index entry, which we don't do now, but
> it seems justifiable on multiple grounds --- besides this point, the
> search could avoid doing the data-type-specific comparison if the hash
> code isn't equal.

It seems that means doubling the size of the hash index. That's a pretty big
i/o to cpu tradeoff.

What if the hash index stored *only* the hash code? That could be useful for
indexing large datatypes that would otherwise create large indexes. A good
hash function should have a pretty low collision rate anyways so the
occasional extra i/o should more than be outweighed by the decrease in i/o
needed to use the index.

--
greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2005-05-10 06:15:34 Re: Data Modelling Tools
Previous Message Marek Lewczuk 2005-05-10 05:41:58 Re: [PHP] Any experiance with PostgreSQL and SQLRelay

Browse pgsql-performance by date

  From Date Subject
Next Message Kim Bisgaard 2005-05-10 09:03:34 full outer performance problem
Previous Message Neil Conway 2005-05-10 05:29:48 Re: [PERFORM] "Hash index" vs. "b-tree index" (PostgreSQL