Re: Need to find the no. of connections for a database

From: "Ireneusz Pluta/wp(dot)pl" <ipluta(at)wp(dot)pl>
To: "sivapostgres(at)yahoo(dot)com" <sivapostgres(at)yahoo(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Need to find the no. of connections for a database
Date: 2020-02-27 16:33:47
Message-ID: ad504885-51ed-e356-b821-ec9b73dc0810@wp.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

W dniu 2020-02-27 o 15:26, sivapostgres(at)yahoo(dot)com pisze:
> Need to lock around 10 tables.  Let me try with pg_advisory_lock().

I am not sure why you mention table locks at this point. Just in case: with advisory locks you lock
an "application flow", not database objects.

>
>
> On Thursday, 27 February, 2020, 07:39:13 pm IST, Ireneusz Pluta/wp.pl <ipluta(at)wp(dot)pl> wrote:
>
>
> W dniu 2020-02-27 o 14:37, sivapostgres(at)yahoo(dot)com <mailto:sivapostgres(at)yahoo(dot)com> pisze:
> > Hello,
> >
> > I'm saying isolation will not work out to my requirement.   The steps.
> >
> > 1.  On completion of all entries by all,  say for a day.
> > 2.  Lock, so that no one enters any other data.
> > 3.  Create a report from the entered data.
> > 4.  Create / Modify required entries from the values arrived in the report. [ long process ]
> > 5.  Once completed, commit all data.
> > 6.  Unlock, so that other users can enter data again.  Data entered will be for another date.
> > Data cannot [should] not entered for the processed date.
> >
> so wouldn't pg_advisory_lock() in step 2, and pg_advisory_unlock() in step 6, make the process work
> in the way you expect?
>
> https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
>
> >
> >
> > On Thursday, 27 February, 2020, 06:29:00 pm IST, Ireneusz Pluta/wp.pl <ipluta(at)wp(dot)pl
> <mailto:ipluta(at)wp(dot)pl>> wrote:
> >
> >
> > W dniu 2020-02-27 o 12:35, sivapostgres(at)yahoo(dot)com <mailto:sivapostgres(at)yahoo(dot)com>
> <mailto:sivapostgres(at)yahoo(dot)com <mailto:sivapostgres(at)yahoo(dot)com>> pisze:
>
> >
> > > I need to prevent other users from entering any transaction till I finish taking reports from my
> > > application.  All users will be using the same application, from which this report is supposed to
> > > be printed.
> >
> > >
> > maybe advisory lock is what you need?
> >
> > https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS
> >
> >
> >
> >
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc 2020-02-27 17:08:08 Re: Postgres 12.1 : UPPER() in WHERE clause restarts server
Previous Message Kouber Saparev 2020-02-27 16:08:17 Re: Is it safe to rename an index through pg_class update?