Re: [SQL] inserts/updates problem under stressing !

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] inserts/updates problem under stressing !
Date: 1999-07-26 02:39:14
Message-ID: 379BCA51.85DC8C9A@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Tom Lane wrote:
>
> I wonder whether this doesn't have a problem with concurrent access:
>
> 1. Transaction A does 'Select count into cnt', gets (say) 200.
> 2. Transaction B does 'Select count into cnt', gets 200.
> 3. Transaction A writes 201 into hits record.
> 4. Transaction B writes 201 into hits record.
>
> and variants thereof. (Even if A has already written 201, I don't think
> B will see it until A has committed...)

You're right, Tom.

> I am not too clear on MVCC yet, but I think you need "SELECT FOR UPDATE"
> or possibly an explicit lock on the hits table in order to avoid this
> problem. Vadim, any comments?

SELECT FOR UPDATE will not help: if there was not record for
particular key then nothing will be locked and

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-07-26 02:39:47 Re: [HACKERS] Problem with dlopen and PostgreSQL - load of file failed
Previous Message Vadim Mikheev 1999-07-26 02:31:44 Re: [HACKERS] vacuum analyze problem

Browse pgsql-sql by date

  From Date Subject
Next Message Vadim Mikheev 1999-07-26 02:43:00 Re: [SQL] inserts/updates problem under stressing !
Previous Message Tom Lane 1999-07-25 16:00:47 Re: [SQL] ERROR: DefineQueryRewrite: rule plan string too big.