Re: Locking
От | Tom Lane |
---|---|
Тема | Re: Locking |
Дата | |
Msg-id | 8117.966174135@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Locking (Ian West <ian@niw.com.au>) |
Список | pgsql-general |
Ian West <ian@niw.com.au> writes: > The question I think is more can I set the default action on requiring a > lock on a record which is in use to be fail, rather than wait. Or can I > specify how long to wait. OK, I see. No, there's no such facility at the moment, though it seems like something worth thinking about. > I understand that I can use non-blocking io, and poll for data, and send > an abort after a delay if I don't get my lock within a reasonable time, > but this doesn't help with ecpg as far as I can tell. (Although I may > very well be missing the obvious here :-) Well, you could fire off a subprocess that would simply sleep for X amount of time and then issue the cancel request if it hadn't been killed meanwhile. (There's no restriction that the cancel request come from the same process that issued the query.) A tad tedious but it'd work. Perhaps a better answer is to restructure your application's queries so that you avoid holding FOR UPDATE locks for long periods. regards, tom lane
В списке pgsql-general по дате отправления: