| От | Scott Marlowe |
|---|---|
| Тема | Re: Locking & concurrency - best practices |
| Дата | |
| Msg-id | dcc563d10801141338q20261bf0m3f66dcff7186d8c9@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Locking & concurrency - best practices ("Adam Rich" <adam.r@indigodynamic.com>) |
| Список | pgsql-general |
On Jan 14, 2008 3:31 PM, Adam Rich <adam.r@indigodynamic.com> wrote: > > You should be able to do "select for update" on both parent and child > > records and get the effect you desire. > > > > I don't think that will work. Let me demonstrate: > (this is simplified, but sufficient to make my point) > > -- Connection 1 -- > begin trans; > > select * from parent_tbl > where id=1 for update; > > select count(*) into myvar > from data_tbl where fk=1; You're right. with count(*) involved, you won't be able to get an accurate view. Generally speaking, when you've got to count rows like that, locking the table is the only thing that works. That or changing how you process the data.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера