Re: Question: update and transaction isolation

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Question: update and transaction isolation
Дата
Msg-id GNELIHDDFBOCMGBFGEFOAEPFCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: Question: update and transaction isolation  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
> > 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.

can you break it into this:

begin;
select counter from pagecounts where pagename='testpag.php' for update;
update pagecounts set counter=counter+1 where pagename='testpag.php';
commit;

Chris



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

Предыдущее
От: Hiroshi Inoue
Дата:
Сообщение: Re: timeout implementation issues
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: timeout implementation issues