Re: Question: update and transaction isolation

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Question: update and transaction isolation
Дата
Msg-id Pine.LNX.4.30.0204031232170.684-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: Question: update and transaction isolation  (mlw <markw@mohawksoft.com>)
Ответы Re: Question: update and transaction isolation  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список pgsql-hackers
mlw writes:

> For each page hit, I do this:
>
> update pagecounts set counter = counter + 1 where pagename = 'testpag.php'
>
> Do I have to set a particular isolation level? Or does this not work in
> general?

In read committed level, if the second update launches before the first
update is finished (commits), then both of these updates will operate on
the old counter value.  That is, you miss one page hit.

If it's possible, you might want to consider "logging" your page hits and
make a view for the page counts (with group by, etc.).  That will get you
around the concurrency issues altogether.

-- 
Peter Eisentraut   peter_e@gmx.net



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Suggestions please: names for function cachability
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Suggestions please: names for function cachabilityattributes