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 853EAD77A5 for ; Wed, 12 Oct 2005 12:38:33 -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 46365-05 for ; Wed, 12 Oct 2005 15:38:28 +0000 (GMT) Received: from natfrord.rzone.de (natfrord.rzone.de [81.169.145.161]) by svr1.postgresql.org (Postfix) with ESMTP id D8BBFD7DB9 for ; Wed, 12 Oct 2005 12:38:27 -0300 (ADT) Received: from [192.168.23.3] (F50a8.f.strato-dslnet.de [195.4.80.168]) (authenticated bits=0) by post.webmailer.de (8.13.1/8.13.1) with ESMTP id j9CFcPTX012511; Wed, 12 Oct 2005 17:38:26 +0200 (MEST) Message-ID: <434D2DE8.5050700@raygina.de> Date: Wed, 12 Oct 2005 15:38:16 +0000 From: Thomas Rokohl User-Agent: Thunderbird 1.4.1 (Windows/20051006) MIME-Version: 1.0 To: Merlin Moncure Cc: pgsql-odbc@postgresql.org Subject: Re: lock - feedback References: <6EE64EF3AB31D5448D0007DD34EEB3417DD593@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD593@Herge.rcsinc.local> 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.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200510/66 X-Sequence-Number: 6168 Merlin Moncure wrote: > There is no 100% correct answer to this problem. However, you are > thinking in terms of pessimistic locking (like most people do), so by > all means use it. > > By 'lost update' problem, I assume you mean > user A reads > user B reads > user A writes > user B writes <-- overwrites user A's changes > > I suggest you read up on locking strategies. Pessimistic is the easiest > way to solve this problem but rarely the best way. Worst problem here > is you are blocking on reads which (drastically) lowers concurrency and > forces your app to be prepared to handle read failures...this can be a > huge headache. > > Pure optimistic locking (in example above) is obviously not suitable in > multi user applications if you care about your data. However, you could > use timestamps + assertions to throw an error during an update if you > are out of synch with the server here. The major difference here is > that you are making user aware of problem when it happens, not when your > app thinks it might happen. This type of lock resolution can be made > via rules, triggers, or a specialized dynamic sql procedure to resolve > the record. > > also, this is off-topic for odbc list :) > > merlin > > > sure it is big problem, but i think you can solve it with different locking types. if you have a write look and no read looks it should work. i mean if you never ban the reading of the data but you guarantee with write locks than only one user can have a record in write-mode everything is fine and nothing is slow. and this is the point where i want to pop up a dialog with the message that someone else edit the record yet.