| От | Vadim Mikheev |
|---|---|
| Тема | Re: [SQL] inserts/updates problem under stressing ! |
| Дата | |
| Msg-id | 379BCA51.85DC8C9A@krs.ru обсуждение |
| Ответ на | Re: [SQL] inserts/updates problem under stressing ! (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера