dbTalk Databases Forums  

Hash indexes

comp.databases.postgresql comp.databases.postgresql


Discuss Hash indexes in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mladen Gogala
 
Posts: n/a

Default Hash indexes - 12-14-2009 , 03:42 PM






PostgreSQL has hash indexes, very similar to Oracle bitmap indexes.
Oracle warns the application designers against using them in the OLTP
applications because of the locking. Namely, locking a row would lock all
the rows which hash to the same hash value as the original row.
My question is whether the same thing applies to the PostgreSQL hash
indexes? In the documentation page, I found the following:

http://www.postgresql.org/docs/8.4/i...xes-types.html

CREATE INDEX name ON table USING hash (column);

Note: Hash index operations are not presently WAL-logged, so hash
indexes might need to be rebuilt with REINDEX after a database crash. For
this reason, hash index use is presently discouraged.


My question is whether someone here has played with the hash indexes? Any
words of caution or blissful experiences? Thanks.

--
http://mgogala.byethost5.com

Reply With Quote
  #2  
Old   
Thomas Kellerer
 
Posts: n/a

Default Re: Hash indexes - 12-15-2009 , 01:31 AM






Mladen Gogala, 14.12.2009 22:42:
Quote:
PostgreSQL has hash indexes, very similar to Oracle bitmap indexes.
Oracle warns the application designers against using them in the OLTP
applications because of the locking. Namely, locking a row would lock all
the rows which hash to the same hash value as the original row.
My question is whether the same thing applies to the PostgreSQL hash
indexes? In the documentation page, I found the following:

http://www.postgresql.org/docs/8.4/i...xes-types.html

CREATE INDEX name ON table USING hash (column);

Note: Hash index operations are not presently WAL-logged, so hash
indexes might need to be rebuilt with REINDEX after a database crash. For
this reason, hash index use is presently discouraged.


My question is whether someone here has played with the hash indexes? Any
words of caution or blissful experiences? Thanks.
The only reason in Oracle to use a bitmap index is - as far as I know - to enable Oracle to use more than one index for retrieval. Postgres can do this with regular indexes anyway, so from that perspective there is no reason to use hash indexes.

I think I recall some messages on the mailing lists that the dev team sees the hash index as a second-class citizen, mainly because it gives no advantage over a regular index. But I'm not 100% if memory serves me well here.

Better ask that question on the mailing list.

Thomas

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.