Proposal for Performance improvement for unique checks

Lists: pgsql-hackers
From: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
To: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal for Performance improvement for unique checks
Date: 2010-03-27 07:11:32
Message-ID: 9362e74e1003270011i376e1647u847535aa1421ff33@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I don't think this should involve much code change. But no-one
interested????

On Sat, Mar 27, 2010 at 2:23 AM, Gokulakannan Somasundaram <
gokul007(at)gmail(dot)com> wrote:

> Hi,
> Since we insert a new entry into the index for every update that's being
> made into the table, we inevitably make a unique check against the older
> version of the newly inserted row, even when the values are not updated. Of
> course i am talking about non-HOT updates. (We will not go to the index for
> HOT updates)
>
> a) The page which contains the index entry is Exclusively locked
> b) We go ahead and visit the heap page for its HeapTupleSatisfiesDirty.
>
> If we have the information of the old tuple(its tuple-id) after a heap
> update, during the index insert, we can avoid the uniqueness check for this
> tuple,as we know for sure that tuple won't satisfy the visibility criteria.
> If the table has 'n' unique indexes it avoids 'n' heap tuple lookups, also
> increasing the concurrency in the btree, as the write lock duration is
> reduced.
>
> Any comments?
>
> Thanks,
> Gokul.
>


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
Cc: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal for Performance improvement for unique checks
Date: 2010-03-27 21:04:23
Message-ID: 4BAE72D7.5030309@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 3/27/10 12:11 AM, Gokulakannan Somasundaram wrote:
> I don't think this should involve much code change. But no-one
> interested????

We're in the test period for 9.0, so potential 9.1 features are going to
get less attention. If it's a small amount of code, I suggest just
writing the patch and posting it (here or as a git branch) for others to
test.

--
-- Josh Berkus