Re: Why is Hash index not transaction safe.

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Wei Shan <weishan(dot)ang(at)gmail(dot)com>
Cc: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Why is Hash index not transaction safe.
Date: 2015-05-09 23:17:10
Message-ID: 20150509231710.GA30713@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, May 6, 2015 at 02:02:23PM +0800, Wei Shan wrote:
> Hi Sameer,
>
> Nice to see you around!
>
> The developer wanted to use HASH indexes as the query hitting some columns are
> only using equality comparison (=). They said that HASH has a speed of O(1)
> whereas B-Tree has a speed of logarithm. I believe it's true if you look
> fundamentally at hashtable and B-Tree algorithm.
>
> However, I did my research and found that HASH index has minimal perfomance
> improvement over B-Tree in equality comparison.
>
> Thus, we dropped the idea already :)

Yes, we have heard this many times, and PG 9.5 will issue a warning if
you create a hash index:

WARNING: hash indexes are not WAL-logged and their use is discouraged

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Pascal Cloup 2015-05-11 08:46:56 count of databases by role/user
Previous Message Tom Lane 2015-05-06 22:13:09 Re: Postmaster.pid - what do the various lines stand for?