Re: locks and triggers. give me an advice please

Поиск
Список
Период
Сортировка
От sad
Тема Re: locks and triggers. give me an advice please
Дата
Msg-id 200407210901.13421.sad@bankir.ru
обсуждение исходный текст
Ответ на Re: locks and triggers. give me an advice please  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-sql
thnx.

i try to sound the idea to ensure myself that you are right.

> begin transaction;
> lock t1 in access exclusive mode;
>
> Turn off triggers and do your updates.
> (Note, "truncate t1" is faster than "delete from t1" followed by a
> "vacuum full" and you might consider running "reindex table t1" after
> your mass update or if appropriate drop your indexes, load the data,
> then recreate them.)
>
> Re-establish triggers.
>
> commit; --end of transaction unlocks the table

in case another user inserts a record into an adjuscent table with the value
of reference field NOT IN t1.
the constraint causes reading of t1 to look up FK value IN t1.
so my EXCLUSIVE lock prevents even reading and this user operation will be
queued.





В списке pgsql-sql по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: surrogate key or not?
Следующее
От: Oliver Elphick
Дата:
Сообщение: Re: Inherited tables and new fields