Re: USING HASH considered harmful?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: srn(at)commsecure(dot)com(dot)au
Cc: pgsql-general(at)postgresql(dot)org, Mark Greenaway <mark(at)commsecure(dot)com(dot)au>
Subject: Re: USING HASH considered harmful?
Date: 2001-08-17 02:13:22
Message-ID: 27621.998014402@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephen Robert Norris <srn(at)commsecure(dot)com(dot)au> writes:
> We've just discovered a rather nasty feature of hashes, namely that
> simultaneous reads & writes to a single row will deadlock if there
> is a hash index on the table.

The hash index code is documented to be subject to deadlocks, but I've
never looked into it to discover the exact conditions that cause
problems.

I could maybe get excited about fixing this if I could think of one
single application wherein a hash index is superior to a btree index.
But I can't, so I think the hash index code should be deprecated and
left to die quietly.

(This para strictly MHO:) In the long run the btree and GIST index types
will probably be the only two of the four present types that remain
supported. Since btree dominates hash and GIST dominates rtree for
functionality, it's hard to see why we should expend development effort
on the other two. Right now, GIST isn't really ready for prime time
either (no support for concurrent updates), but it does things that
btree can't do, so there's reason to expend work on it.

As of today, if you're concerned about concurrent updates, btree is the
only Postgres index type you should be using.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Inoue 2001-08-17 02:42:36 Re: Perfomance decreasing
Previous Message Randall Perry 2001-08-17 02:01:08 assigning result of SELECT in TRIGGER