Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Admin > updating table ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 4899 of 5124
Post > Topic >>

updating table with foreign keys cause locking of referenced row/table?

by jeff@[EMAIL PROTECTED] (Jeff Frost) Apr 10, 2008 at 02:39 PM

Postgresql-8.3.1

I have a plpgsql function which is called nightly to update rows in a
summary 
table.  The summary table has foreign keys that reference the users table.

When the nightly job runs, the users table gets locked such that UPDATES
to 
the user table are stuck waiting on the transactionid of the function.

The function does not update or select for update any rows in the users
table 
and removing the foreign keys in the summary table allows the UPDATES of
the 
users table to happen with no problem.

Interestingly, in testing this, I started a transaction, updated a bunch
of 
rows in the summary table with UPDATE, left the transaction open, started 
a new session and successfully updated rows in the users table that are 
pointed to by the updated rows in the summary table.  So there doesn't
seem to 
be a locking problem outside of the function.

Is the locking behavior different inside a plpgsql function?

-- 
Jeff Frost, Owner 	<jeff@[EMAIL PROTECTED]
>
Frost Consulting, LLC 	http://www.frostconsultingllc.com/
Phone: 650-780-7908	FAX: 650-649-1954

-- 
Sent via pgsql-admin mailing list (pgsql-admin@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
 




 1 Posts in Topic:
updating table with foreign keys cause locking of referenced row
jeff@[EMAIL PROTECTED] (  2008-04-10 14:39:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 0:55:45 CDT 2008.