Re: [GENERAL] database-level locking

From: Marcin Grondecki <ojciec(at)mtl(dot)pl>
To: kdebisschop(at)spaceheater(dot)infoplease(dot)com, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] database-level locking
Date: 1999-03-20 04:05:48
Message-ID: 3.0.6.32.19990319200548.007fee80@mtl.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

try this:
begin;
lock <tname1>;
...

end;

In the meantime, while you locked every table in your database with
locks, and before "end" or "commit" or "rollback", no user can
read/write none of your tables. You can delete temporary files,
and then restore database functionality.
It should word in 6.4.2, i'm not sure if it could work in 6.5 because
of major changes in locking subsystem (readers'll have access to locked
tables?).

Second way it's simply to modify pghba.conf, to revoke access to databases
for every user/domain; delete smth, whatever you want and restore access.
I'm not sure if it break current connections, rollback transactions etc.
- you should test it ;)

At 13:57 99-03-19 -0500, Karl DeBisschop wrote:
>
>Does anyone know a way to lock a database under postgres while
>leaving available the other databases managed by postmaster?
>
>We are running postgreSQL 6.4.2 on our web site for content serving
>and for registration information. There are 4 separate databases
>served by postmatser to support these functions.
>
>Every now and the we have manually deleted temporary sort files to
>keep disk usage in control. We'd like to automate this process, but
>to do so safely we need to ensure that no sorts are being run while we
>delete the accumualted files. Thus, we'd like to lock a database,
>delete its accumulated wastage, unlock the database, and move on to
>the next.
>
>Of course the better solution would be if postgres was always able to
>identify and clear out its excesses, but we have found that is not the
>case.
>
>Karl
>
>
Marcin Grondecki
ojciec(at)mtl(dot)pl
+48(604)468725
***** I'm not a complete idiot, some parts are missing...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcin Grondecki 1999-03-20 04:13:02 Re: [GENERAL] trouble with sum
Previous Message Marcin Grondecki 1999-03-20 03:52:37 Re: [GENERAL] trouble with sum