Re: [INTERFACES] locking on database updates

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: [INTERFACES] locking on database updates
Дата
Msg-id Pine.LNX.4.10.9912061016440.4887-100000@salmo.appl-ecosys.com
обсуждение исходный текст
Ответ на locking on database updates  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-interfaces
On Mon, 6 Dec 1999, Gary Stainburn wrote:

> Pseudo Code
> 
> Select & lock record
> increment number
> Update record
> Unlock record
 What I learned from writing databases in Paradox/DOS is to change the
sequence so that steps 2 and 3 are switched. That is, wait until the record
is committed to be added, then grab the next number and assign it.
 The advantage is that if the record is not added (user changed her mind or
had to go do something else right away), the ID table is untouched. Also,
assigning the unique number just before writing the record means that the ID
table is locked, incremented and unlocked very quickly. No one is slowed
down by this process.

HTH,

Rich

Dr. Richard B. Shepard, President
                      Applied Ecosystem Services, Inc. (TM)             Making environmentally-responsible mining
happen.(SM)                               --------------------------------           2404 SW 22nd Street | Troutdale,
OR97060-1247 | U.S.A.+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com
 



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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: locking on database updates
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [INTERFACES] locking on database updates