Re: how to make an 'UNLOCK'?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Grand Titus" <grand(dot)titus(at)free(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to make an 'UNLOCK'?
Date: 2002-11-30 16:44:57
Message-ID: 485.1038674697@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Grand Titus" <grand(dot)titus(at)free(dot)fr> writes:
> And I don't know how to unlock a table, I can't find the command 'UNLOCK'.

There is no UNLOCK short of committing your transaction. If you had
one, your code would not work anyway (because you'd be unlocking the
table before the next guy could see your uncommitted updates).

I'd suggest using an optimistic-locking approach instead: don't lock
at all, just rely on unique indexes to prevent duplicate insertions.
Once in a while you will get a collision, and then you'll have to
roll back your transaction and try again --- but if that only seldom
happens, it's a lot faster than locking every time.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-11-30 16:46:16 Re: vacuum full analyze problem
Previous Message Tom Lane 2002-11-30 16:23:51 Re: how to get argument number