Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Re: Multi field hash indexes

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: ocie(at)paracel(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: Multi field hash indexes
Date: 1998-03-17 19:55:42
Message-ID: 350ED53E.1C81DF82@sid.trust.ee (view raw or flat)
Thread:
Lists: pgsql-hackers
ocie(at)paracel(dot)com wrote:

> Hannu Krosing wrote:
> >
> > The trick is to hash each field separately and then have a concatenation
> >
> > of the hash values.
> >
> > so assuming that for fields (a,b,c) values (120, 'friday', 3.1415927)
> > hash
> > to 'aa', 'bb', 'cc' the hash value of the whole tuple will be 'aabbcc'
> >
> > then the index can be used not only when selecting  = a,b,c but also
> > when
> > selecting on _any_ of the fields in this index. For example when
> > selecting
> > for b='friday' one would examine only buckets where the middle is 'bb'
> >
>
> HMM, this doesn't feel right.  If I have an index on four int4s
> a,b,c,d and I only know d, then it seems like searching for these in
> the hash table could be as much work, or more work than a table scan.

I was assuming that the hash table scan would be cheaper than the table scan

> > > Therefore, I would like to try implementing unique constraints on hash
> >
> > > indexes.  Has this come up before?  Are there any reasons not to
> > > support this?  As far as I understand, specifying an index method is
> > > non standard (above and beyond standard) to begin with.
> >
> > While you are at it could you please comment if the GIST indexes are
> > used or
> > at least easily usable?
>
> What are GIST indexes?

Some kind of generalised binary tree indexes that should make it easy to
define additional indexing strategies.

There is a directory access/gist in src/backend, and they are briefly
mentioned in the PostgreSQL programmers guide.

They seem to be offspring of some independent (of postgres) Berkeley project.

Hannu


In response to

Responses

pgsql-hackers by date

Next:From: The Hermit HackerDate: 1998-03-17 20:35:41
Subject: New patch to try...
Previous:From: ocieDate: 1998-03-17 19:41:46
Subject: Re: [HACKERS] Re: Multi field hash indexes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group