Re: Checking if a table locked from pl/pgsql

From: "Jose Luis LG" <jlopezgonz(at)terra(dot)es>
To: "'Jan Wieck'" <janwieck(at)yahoo(dot)com>, "'Hal Davison'" <hal(at)faams(dot)net>
Cc: "'PostgreSQL-interfaces'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Checking if a table locked from pl/pgsql
Date: 2002-03-27 16:06:02
Message-ID: 001001c1d5a9$4b8d8640$424d4d7d@Servidor2K.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

In my case I have several clients updating a table at the same time with
each client having several threads updating tables. With what mechanism
other than locks can you insure for example that at any instant
duplicate keys are not generated?

The lock in the application is released as soon as the thread finishes
work.
Jose

> -----Original Message-----
> From: Jan Wieck [mailto:janwieck(at)yahoo(dot)com]
> Sent: miércoles, 27 de marzo de 2002 16:37
> To: Hal Davison
> Cc: Jan Wieck; Jose Luis LG; 'PostgreSQL-interfaces'
> Subject: Re: Checking if a table locked from pl/pgsql
>
> Hal Davison wrote:
> >
> > In an operational sense, if a user is updating a table for some
> accounting
> > function then decides to go to lunch leaving the table locked.
>
> Exactly what I expected. You have a severe design flaw in
> your application. Database transactions have to be short and
> never held over actions that could infinitely block, such as
> user interaction, period!
>
> You need application level advisory locks. The abuse of
> database locks for that will not get you very far. Your
> application will not scale and suffer from problems like the
> one you already face.
>
> Ever thought about adding a WEB interface to that
> application? If a user editing some account needs to hold a
> DB lock all the time, you'll not implement it with
> Apache/PHP, that's for sure already. And you'll have to make
> alot of painfull pushups to do it with any other WEB server
> technology.
>
>
> Jan
>
> >
> > --Hal.
> >
> > ===========================================================
> > Hal Davison Internet Petroleum Distribution
> > Davison Consulting LSE Linux V1.22
> > 6850 Myakka Valley Tr PostgreSQL 7.03 - Sun Forte - JAVA
> > Sarasota, Florida 34241 Phone: (941) 921-6578
> > http://www.faams.net FAX: (941) 924-7135
> > ===========================================================
> >
> > On Mon, 25 Mar 2002, Jan Wieck wrote:
> >
> > > Jose Luis LG wrote:
> > > > Hi,
> > > >
> > > > Could anybody tell me if it is posible to check if a if a table
is
> being
> > > > locked from pl/pgsql functions.
> > >
> > > Yes, it is not.
> > >
> > > That you ask for such a functionality leads to the question,
> > > why can a lock exist long enough that you want to check at
> > > all?
> > >
> > >
> > > Jan
> > >
> > > --
> > >
> > >
>
#======================================================================#
> > > # It's easier to get forgiveness for being wrong than for being
right.
> #
> > > # Let's break this rule - forgive me.
> #
> > > #==================================================
JanWieck(at)Yahoo(dot)com
> #
> > >
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >
> > > ---------------------------(end of
broadcast)-------------------------
> --
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> > >
> >
> >
> > ---------------------------(end of
broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
> >
>
>
> --
>
>
#======================================================================#
> # It's easier to get forgiveness for being wrong than for being right.
#
> # Let's break this rule - forgive me.
#
> #================================================== JanWieck(at)Yahoo(dot)com
#
>
>
>
>
> _________________________________________________________
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at http://mail.yahoo.com
>

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jan Wieck 2002-03-27 16:36:15 Re: Checking if a table locked from pl/pgsql
Previous Message Hal Davison 2002-03-27 15:45:51 Re: Checking if a table locked from pl/pgsql