From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: postgresql locks the whole table! |
Date: | 2003-12-03 17:13:47 |
Message-ID: | 874qwh7rjo.fsf@stark.dyndns.tv |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dr NoName <spamacct11(at)yahoo(dot)com> writes:
> My question is why??? The two insert operations do not
> conflict with each other (at least not in the
> real-world situation). Also, why does the foreign key
> make a difference?
It's not locking the whole table, it's locking the record that the foreign key
references. Note that they're both referencing the same foreign key.
It does this because it's afraid someone will go and delete that key before
the transaction commits. It has to take a lock that will prevent someone from
deleting the record (or updating the referenced column).
Unfortunately the only lock to choose from is an exclusive write lock. That's
overkill as you've noticed. I think this is something multiple people would
like to fix by introducing shared locks, but I wouldn't expect a solution
soon.
I don't know if there's any work-around better than just dropping the foreign
key reference.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Bopolissimus Platypus | 2003-12-03 17:16:49 | Any *current* summary of postgres-r 7.2 status? (was Re: Feature Request for 7.5) |
Previous Message | Christopher Browne | 2003-12-03 17:06:15 | Re: Teach Yourself PostgreSQL book |