From: Richard Huxton <dev@archonet.com>
To: Thomas Rokohl <rokohl@raygina.de>
Cc: pgsql-odbc@postgresql.org
Subject: Re: lock - feedback
Date: Wed, 12 Oct 2005 14:58:14 +0100
Message-ID: <434D1676.3010509@archonet.com> (raw)
In-Reply-To: <434D0DF9.3010702@raygina.de>
References: <434CEB1A.4050102@raygina.de>
<434CF612.8010705@archonet.com>
<434CFB5E.6000402@raygina.de>
<434D0847.3080908@archonet.com>
<434D0DF9.3010702@raygina.de>
Thomas Rokohl wrote:
>>>
>>> so but i'm not sure, doesn't it mean that all statements that take
>>> longer than this time will be abort?
>>> if it is so, that isn't a solution for this problem because than i
>>> can't make a "big" request anymore.
>>
>> You can change it during a session "set statement_timeout=2000"
>>
> yes, but that isn't a certain event that say that the data is locked!
> also the network for example can determine different timeouts.
Yes, but network timeouts will be of the order of several minutes -
hours. You're not holding your locks for that long are you? Are you
really saying your SELECT FOR UPDATE queries can take more than a couple
of seconds to complete?
> and also i don't know the working time for each request before.
> that isn't a solution for me. i will open a "please wait, while the data
> is locked" - window, if the data is locked.
So, you want to write code something like:
WHILE (still_trying)
SELECT ... FOR UPDATE
IF (failed) THEN
IF (errcode=lock) THEN display_please_wait_message()
ELSE display_error_message_and_abort()
END IF
ELSE
got_lock = true
END IF
END WHILE
IF got_lock THEN
do_my_updates()
END IF
All I'm saying is around "SELECT ... FOR UPDATE" you put two "SET
statement_timeout" to set a short timeout and then revert it.
> and it seems as if this should be a problem with postgres :-(
Perhaps - you can apply NOWAIT to "LOCK TABLE" and I think in 8.1 to
"SELECT FOR UPDATE" also. That's not much use if you're stuck with 8.0
for the moment though. It also doesn't actually change the logic of the
code above.
Or am I missing something here?
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: dev@archonet.com, rokohl@raygina.de
Subject: Re: lock - feedback
In-Reply-To: <434D1676.3010509@archonet.com>
References: <434CEB1A.4050102@raygina.de> <434CF612.8010705@archonet.com> <434CFB5E.6000402@raygina.de> <434D0847.3080908@archonet.com> <434D0DF9.3010702@raygina.de> <434D1676.3010509@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox