Re: todo: Hash index creation

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Kenneth Marshall <ktm(at)rice(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, twraney(at)comcast(dot)net, pgsql-hackers(at)postgresql(dot)org
Subject: Re: todo: Hash index creation
Date: 2007-07-05 11:26:45
Message-ID: 468CD575.60300@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kenneth Marshall wrote:
> I definitely agree with Tom's assessment. If we cannot need to make the
> hash index as performant as it is in theory, none of the other refinements
> are worth it. You would need to use BTree if you were concerned about
> speed. (and who isn't)

I just got an idea.

Hash indexes would take much less space, and be more efficient to
search, if we only stored the hash of the key in the index. Such index
tuples would be fixed size, so we could get rid of the overhead of the
length-field in IndexTuple, as well as the line pointers.

Of course, the key value would need to be rechecked after fetching the
heap tuple, but that shouldn't be a problem assuming there's few collisions.

Another idea: when searching, we scan the whole bucket page looking for
matching tuples. If we stored the tuples ordered by hash value within
page, we could do a binary search instead.

These changes might give hash indexam the edge over b-tree it needs.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian G. Pflug 2007-07-05 13:01:06 Re: Still recommending daily vacuum...
Previous Message Gregory Stark 2007-07-05 08:05:18 Re: SetBufferCommitInfoNeedsSave and race conditions