Re: shared Locks

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: shared Locks
Дата
Msg-id 20050920103219.GC8586@svana.org
обсуждение исходный текст
Ответ на Re: shared Locks  (Daniel Schuchardt <daniel_schuchardt@web.de>)
Ответы Re: shared Locks
Список pgsql-general
On Tue, Sep 20, 2005 at 12:01:46PM +0200, Daniel Schuchardt wrote:
> Martijn van Oosterhout schrieb:
> >I think you'll find that locks are held to the end of the transaction.
> >You're not holding a transaction open but not doing anything, are you?
> >
> >
> Yes you'r right here. Because we use Cursor Fetch, every statement
> starts a transaction. So your right I tested it and this forces a table
> lock. Hm... i will look how to do this in another way.

Just COMMIT when you're done. This does kill the cursor though...

If you put a timeout in your app so that it commits that transaction
after, say, 30 seconds idle then your ALTER commands will only wait for
a while. Although, your ALTER will in turn block the following users...

Is your biggest problem that people tend to leave connections open
overnight or something? I simple timeout would work fine if there you
only want to make changes when there are just a few active users.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Daniel Schuchardt
Дата:
Сообщение: Re: shared Locks
Следующее
От: Gábor Farkas
Дата:
Сообщение: how to read the transaction logs?