Re: postgresql locks the whole table!

Поиск
Список
Период
Сортировка
Искать
От
Greg Stark
Тема
Re: postgresql locks the whole table!
Дата
Msg-id
874qwh7rjo.fsf@stark.dyndns.tv
Ответ на
Список
Дерево обсуждения
postgresql locks the whole table! Dr NoName <spamacct11@yahoo.com>
Re: postgresql locks the whole table! Mike Mascari <mascarm@mascari.com>
Re: postgresql locks the whole table! "Alistair Hopkins" <alistair@berthengron.co.uk>
Re: postgresql locks the whole table! Jan Wieck <JanWieck@Yahoo.com>
Re: postgresql locks the whole table! Dr NoName <spamacct11@yahoo.com>
Re: postgresql locks the whole table! Dr NoName <spamacct11@yahoo.com>
Re: postgresql locks the whole table! Jan Wieck <JanWieck@Yahoo.com>
Re: postgresql locks the whole table! Scott Ribe <scott_ribe@killerbytes.com>
Re: postgresql locks the whole table! Greg Stark <gsstark@mit.edu>
Re: postgresql locks the whole table! Bruce Momjian <pgman@candle.pha.pa.us>
Re: postgresql locks the whole table! Jeff Davis <jdavis-pgsql@empires.org>
Re: postgresql locks the whole table! Bruce Momjian <pgman@candle.pha.pa.us>
Re: postgresql locks the whole table! Greg Stark <gsstark@mit.edu>
Re: postgresql locks the whole table! Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: postgresql locks the whole table! Greg Stark <gsstark@mit.edu>
Re: postgresql locks the whole table! Mike Mascari <mascarm@mascari.com>
Re: postgresql locks the whole table! Tom Lane <tgl@sss.pgh.pa.us>
Re: postgresql locks the whole table! Scott Ribe <scott_ribe@killerbytes.com>

Dr NoName  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
В списке pgsql-general по дате отправления
От: Jan Wieck
Дата:
От: Bopolissimus Platypus
Дата:
FAQ