X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC991D7D8D for ; Wed, 12 Oct 2005 12:10:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38266-07 for ; Wed, 12 Oct 2005 15:10:38 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 0CDD7D7B2C for ; Wed, 12 Oct 2005 12:10:37 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 5FFCA415415; Wed, 12 Oct 2005 16:10:25 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 1067615ED5; Wed, 12 Oct 2005 16:06:23 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28767-08; Wed, 12 Oct 2005 16:06:18 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5D83615EDA; Wed, 12 Oct 2005 16:06:01 +0100 (BST) Message-ID: <434D2659.6080801@archonet.com> Date: Wed, 12 Oct 2005 16:06:01 +0100 From: Richard Huxton User-Agent: Thunderbird 1.4.1 (X11/20051006) MIME-Version: 1.0 To: Thomas Rokohl Cc: pgsql-odbc@postgresql.org Subject: Re: lock - feedback 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> <434D1CAB.7070802@raygina.de> In-Reply-To: <434D1CAB.7070802@raygina.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 required=5 tests=[AWL=0.009, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/65 X-Sequence-Number: 6167 Thomas Rokohl wrote: > Richard Huxton wrote: >> 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? > yes normally not, but it can happened. let something goes wrong, for > example the network is busy or the db server is busy or something like > that. if the number of request to a server is high enough it will be slow. > whatever it isn't a certain event for locks. > >> All I'm saying is around "SELECT ... FOR UPDATE" you put two "SET >> statement_timeout" to set a short timeout and then revert it. > yes it is clear what you mean but it can also make trouble and a > deadlock if the timeout is the short for the request. No, you can't get a deadlock. You could get an update failing when it could theoretically have worked if you had a longer timeout. >>> 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. > i had read it and i had trouble with the beta so i us the stable version. > but NOWAIT is a certain event for locks, the timeout isn't one. Actually, in either case you'll need to check the return-code. Just because you added NOWAIT doesn't mean there can't be some other reason the query failed. As you have pointed out though, if your query needs 3 seconds and you set the statement timeout to 2 seconds then it'll never work. In practice, it's less of a problem than you might think. -- Richard Huxton Archonet Ltd