Re: Using hashtext and unique constraints together

From: "Peter Childs" <peterachilds(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using hashtext and unique constraints together
Date: 2007-12-12 08:09:35
Message-ID: a2de01dd0712120009w298b7009qd1c3cf919b3881aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/12/2007, Mason Hale <masonhale(at)gmail(dot)com> wrote:
>
>
> I'm thinking that an insert trigger that ensures (SELECT count(*) FROM
> page WHERE hashtext(url) = hashtext('http://www.postgresql.org'<http://www.postgresql.org%27>)
> AND url = ' http://www.postgresql.org' ) = 0 won't work given MVCC, as two
> transactions could simultaneously insert the same url at the same time.

Why not so long as it also locks the table (share lock should be enough) but
it could slow the table down if lots of transactions write to the table at
once.

Regards

Peter.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Childs 2007-12-12 08:31:15 Re: top posting
Previous Message Tom Lane 2007-12-12 08:06:33 Re: what is the date format in binary query results