Re: GSoC 2018 Project Ideas & Mentors - Last Call

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: GSoC 2018 Project Ideas & Mentors - Last Call
Date: 2018-01-23 14:07:12
Message-ID: CAA4eK1KATC1TA5bR5eobYQVO3RWsnH6djNpk3P376em4V8MuUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 22, 2018 at 7:17 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Sun, Jan 21, 2018 at 9:02 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> How about adding a project to support Unique capability for the Hash
>> Index?
>
> Hmm, that seems pretty hard.
>

Yeah, but I think here hard part is to decide the solution to achieve
it. The problem is that for the hash index to ensure that there is
no duplicate entry we need to traverse the whole bucket chain and also
we need to ensure that only one backend should be allowed to perform
it. The simplest way to ensure that is to take and retain an
exclusive lock on the primary bucket for the whole operation. Now,
considering that for unique indexes there shouldn't be many overflows
buckets, retaining lock doesn't sound to be much problematic. We can
even think of slightly different locking technique as well which is
that instead of always retaining the lock on the primary bucket, we
can keep the lock on the first bucket where we find the space to
insert the key and then proceed to find the entry again by taking an
exclusive lock on each overflow bucket one-by-one. Only one inserter
should win in this scheme, the others should find the entry inserted
by it and probably the concurrency won't also be bad.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2018-01-23 14:10:47 Re: PATCH: Configurable file mode mask
Previous Message Simon Riggs 2018-01-23 13:51:25 Re: [HACKERS] MERGE SQL Statement for PG11