Skip site navigation (1) Skip section navigation (2)

Re: Proposal: String key space for advisory locks

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Christophe Pettus <xof(at)thebuild(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: String key space for advisory locks
Date: 2009-10-26 14:34:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Alvaro Herrera wrote:
> Christophe Pettus wrote:
>> API Changes:
>> Overloading the various advisory lock functions to take a suitable
>> string type (varchar(64)?) in addition to the bigint / 2 x int
>> variations.  As with the bigint / 2 x int forms, this string
>> namespace would be disjoint from the other key spaces.
> I don't think this can be made to work.  The locktag hash element has a
> fixed size.  Perhaps you could make it work if you hashed the string and
> used that as a locktag, but it would lock too much as soon as two
> strings had matching hashes.

You could add another level of indirection, e.g by adding a new table
that maps the string to a bigint. I doubt it's worth the effort and
performance impact, though. Cleaning up old unused rows from the table
etc. would require a fair amount of work.

  Heikki Linnakangas

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-10-26 14:41:15
Subject: Re: Parsing config files in a directory
Previous:From: Tom LaneDate: 2009-10-26 14:30:04
Subject: Re: Endgame for all those SELECT FOR UPDATE changes: fix plan node order

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group