From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "mlw" <markw(at)mohawksoft(dot)com> |
Cc: | "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Question: update and transaction isolation |
Date: | 2002-04-04 01:38:17 |
Message-ID: | GNELIHDDFBOCMGBFGEFOAEPFCBAA.chriskl@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-04-04 02:21:53 | Re: timeout implementation issues |
Previous Message | Hiroshi Inoue | 2002-04-04 01:25:47 | Re: timeout implementation issues |