Question Regarding Locks

From: Terry Lee Tucker <terry(at)esc1(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Question Regarding Locks
Date: 2004-10-27 21:17:30
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-novice


I am working on converting a transportation application from a Progress
database to PostgreSQL. This application will be hammered by about 75 users
at any given time. Also, depending on the operation, there are many record
updates that occur at the trigger level. I would like to be able to provide
feedback to the user when they select a row for update (using SELECT FOR
UPDATE). At present, if the row is being accessed (with SELECT FOR UPDATE) by
another user, the application just sits there waiting. I spent some time
looking at pg_locks hoping to be able to gain information from that table so
as to programically return something to the user. The stuff I read didn't
look promising. The only thing I've been able to come up with is having my
own "lock" table and inserting a row into it containing the table name, the
pid, the oid of the row, the user id, and a time stamp. Of course, I'm
searching lock table entries before selecting for update and reporting a lock
situation to the user if I find anything. I'm just wondering if I can use
some system table or combination of tables to provide the feed back I need.
Does anyone have any ideas about how to accomplish this? I searched the FAQ
and didn't find anything.

PostgreSQL 7.3.6-RH on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-39)

Quote: 32
"The world we have created is a product of our thinking. It cannot be
changed without changing our thinking."

--Albert Einstein

Work: 1-336-372-6812
Cell: 1-336-363-4719
email: terry(at)esc1(dot)com


Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-10-27 21:26:22 Re: Bug or stupidity
Previous Message Bruno Wolff III 2004-10-27 21:05:11 Re: Bug or stupidity

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-10-27 22:44:29 Re: Question Regarding Locks
Previous Message Tom Lane 2004-10-27 20:24:40 Re: Can't edit pg_hba.conf; and, How do I restart postmaster?