> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: Friday, June 21, 2002 9:52 AM
> To: Tom Lane
> Cc: Neil Conway; mloftis@wgops.com; Dann Corbit;
> pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] What is wrong with hashed index usage?
> 
> 
> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > I remember three problems:  build time, index size, and 
> concurrency
> > > problems.  I was wondering about the equal key case 
> myself, and assumed
> > > hash may be a win there, but with the concurrency 
> problems, is that even
> > > possible?
> > 
> > Sure.  Many-equal-keys are a problem for btree whether you have any
> > concurrency or not.
> > 
> > > OK, I have reworded it.  Is that better?
> > 
> > It's better, but you've still discarded the original's 
> explicit mention
> > of concurrency problems.  Why do you want to remove information?
> 
> OK, concurrency added.  How is that?
> 
> > 
> > > How about an elog(NOTICE) for hash use?
> > 
> > I don't think that's appropriate.
> 
> I was thinking of this during CREATE INDEX ... hash:
> 
> 	NOTICE:  Hash index use is discouraged.  See the CREATE INDEX
> 	reference page for more information.
> 
> Does anyone else like/dislike that?

I think it might be OK temporarily, to show that there is some work that
needs done.  When hashed indexes are fixed, the notice should be
removed.

I have not looked at the hash code.  Here is a strategy (off the top of
my head) that seems that it should work:

Use Bob Jenkins' 64 bit generic hash from here (totally free for use and
fast as blazes):
http://burtleburtle.net/bob/hash/index.html

Specifically:
http://burtleburtle.net/bob/c/lookup8.c and routine: hash( k, length,
level)

Now, with a 64 bit hash, there is very tiny probability of a collision
(but you could have duplicate data).
The hash index would consist of nothing more than this:
[long long hash=64 bit hash code][unsigned nmatches=count of matching
hashes][array of {nmatches} pointers directly to the records with that
hash]

This is probably grotesqely oversimplified.  But maybe it will spur an
indea in the person who writes the indexing code.

Fri, 21 Jun 2002 13:20:18 -0700
"Dann Corbit" <DCorbit@connx.com>
Re: What is wrong with hashed index usage?
Dann Corbit wrote:
> > I was thinking of this during CREATE INDEX ... hash:
> > 
> > 	NOTICE:  Hash index use is discouraged.  See the CREATE INDEX
> > 	reference page for more information.
> > 
> > Does anyone else like/dislike that?
> 
> I think it might be OK temporarily, to show that there is some work that
> needs done.  When hashed indexes are fixed, the notice should be
> removed.

Oh, yes, clearly, we would remove it once we had a hash implementation
that had _any_ advantages over btree.

So, is you vote for or against the elog(NOTICE)?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 21 Jun 2002 16:31:17 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: What is wrong with hashed index usage?
> So, is you vote for or against the elog(NOTICE)?

OK, if we are still voting, then I'll mention that I generally dislike
the idea of notices of this kind. And would not like this notice in
particular. So would vote no with both hands ;)

I'm pretty sure that we have a consensus policy (hmm, at least if a
consensus consists of repeated votes on one question or the other) that
notices to protect people from doing what they ask the system to do are
not generally desirable.

Putting messages in as a spur to development is not particularly
effective; witness a few chapters in the docs which consist of "This
needs to be written. Any volunteers?" and which have stayed untouched
for three years now ;)

                     - Thomas

Fri, 21 Jun 2002 17:57:14 -0700
Thomas Lockhart <lockhart@fourpalms.org>
Re: What is wrong with hashed index usage?
On the other hand, I like hints on how to do things better ;)

David

Thomas Lockhart wrote:

>>So, is you vote for or against the elog(NOTICE)?
>>    
>>
>
>OK, if we are still voting, then I'll mention that I generally dislike
>the idea of notices of this kind. And would not like this notice in
>particular. So would vote no with both hands ;)
>  
>


Fri, 21 Jun 2002 22:10:37 -0400
David Ford <david+cert@blue-labs.org>
Re: What is wrong with hashed index usage?
Which is whay you RTFM ;)

--On Friday, June 21, 2002 10:10 PM -0400 David Ford 
<david+cert@blue-labs.org> wrote:

> On the other hand, I like hints on how to do things better ;)
>
> David
>
> Thomas Lockhart wrote:
>
>>> So, is you vote for or against the elog(NOTICE)?
>>>
>>>
>>
>> OK, if we are still voting, then I'll mention that I generally dislike
>> the idea of notices of this kind. And would not like this notice in
>> particular. So would vote no with both hands ;)
>>
>>
>



Fri, 21 Jun 2002 19:17:22 -0700
Michael Loftis <mloftis@wgops.com>
Re: What is wrong with hashed index usage?
Thomas Lockhart wrote:
> > So, is you vote for or against the elog(NOTICE)?
> 
> OK, if we are still voting, then I'll mention that I generally dislike
> the idea of notices of this kind. And would not like this notice in
> particular. So would vote no with both hands ;)
> 
> I'm pretty sure that we have a consensus policy (hmm, at least if a
> consensus consists of repeated votes on one question or the other) that
> notices to protect people from doing what they ask the system to do are
> not generally desirable.
> 
> Putting messages in as a spur to development is not particularly
> effective; witness a few chapters in the docs which consist of "This
> needs to be written. Any volunteers?" and which have stayed untouched
> for three years now ;)

OK, elog(NOTICE) is voted down.  SGML docs are updated.  We don't need
an FAQ item for this, do we?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Sat, 22 Jun 2002 00:01:02 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: What is wrong with hashed index usage?