Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA01307; Mon, 1 Nov 93 12:10:42 -0800
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9311012010.AA01307@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: nobody@lth.se
Received: from nic.lth.se by postgres.Berkeley.EDU (5.61/1.29)
	id AA01297; Mon, 1 Nov 93 12:10:36 -0800
Received: by mail.lth.se (Smail3.1.28.1 #2)
	id m0ou5aM-000MVDC; Mon, 1 Nov 93 21:10 MET
X-Sender: nobody@lth.se
To: postgres@postgres.Berkeley.EDU
Path: camscan.co.uk!gerry
From: gerry@camscan.co.uk (Gerry Stringer)
Newsgroups: lth.lists.postgres
Subject: Re: Concurrency and locking
Date: 1 Nov 1993 21:10:37 +0100
Organization: Lund Institute of Technology, Sweden
Lines: 45
X-Sender: nobody@news.lth.se
Message-Id: <17435.9310191420@electra.camscan.co.uk>
Resent-To: postgres-dist
Resent-Date: Mon, 01 Nov 93 12:10:41 PST




>>Yes I agree that this is a ``classic'' example.  What I was trying to
>>point out is that trivially simple, but real, applicatins seem to
>>result in deadlock using Postgres.  As an example of this consider a
...
...
>>---
>> Robert Withrow, Tel: +1 617 598 4480, Fax: +1 617 598 4430, Net: witr@rwwa.COM
>> R.W. Withrow Associates, 21 Railroad Ave, Swampscott MA 01907-1821 USA


Someone else who feels the same as me - I have posted on just this
subject quite a bit in the past. It is too easy to to write a query
which can deadlock Postgres and probably lots of other DBs as well. DBs
are supposed to make it look like you're the only user of the data and
do all the necessary work to make it appear so. When writing a query
guaranteed not to deadlock, you have to have a lot of knowledge about
the underlying locking mechanisms. I fully understand the reasons for
this (I worked on DB internals for 4 years) it's just that most DBs
don't help much in this regard.

As far as suggestions for Postgres go, my vote is for the equivalent of a
"retrieve for update" type of clause which just uses write locks
internally instead of read locks. I think it gives just enough hooks to
be able to write a deadlock free transaction while hiding most of the
details.


	Regards,

		gerry


+--------------------------------+---------------------------------+
|Gerry Stringer                  |Phone: +44 954 780926            |
|Cambridge Scanning Company Ltd  |Fax:   +44 954 789829            |
|Saxon Way                       |UUCP : gerry@camscan.co.uk       |
|Bar Hill                        |       gerry@camscan.uucp        |
|Cambridge CB3 8SL               |       			   |
|United Kingdom                  |                                 |
+--------------------------------+---------------------------------+


