Обсуждение: Force removing Locks

Поиск
Список
Период
Сортировка

Force removing Locks

От
Florian Eberle
Дата:
Hello,

I've got a Problem... An Application that uses my Postgres Server always
keeps some locks open... Is there a Possibility to forcing remove the
Locks after a certain Interval or to remove them by hand? Because of
this Locks autovacuum cant work properly on this table and finally
System runs out of Disk Space...

Here is my pg_locks table:
===========================================================================
postgres=# SELECT locktype, relation, pid, mode, granted FROM
pg_catalog.pg_locks;
   locktype    | relation |  pid  |           mode           | granted
---------------+----------+-------+--------------------------+---------
 relation      |  7691926 |  9218 | ShareUpdateExclusiveLock | t
 relation      |  7691926 | 11652 | RowShareLock             | t
 relation      |  7691926 | 11652 | RowExclusiveLock         | t
 virtualxid    |          | 11652 | ExclusiveLock            | t
 relation      |  7691931 |  9218 | RowExclusiveLock         | t
 virtualxid    |          | 21255 | ExclusiveLock            | t
 relation      |  9681822 | 11652 | AccessShareLock          | t
 virtualxid    |          |  9218 | ExclusiveLock            | t
 relation      |  7691929 |  9218 | ShareUpdateExclusiveLock | t
 transactionid |          | 11652 | ExclusiveLock            | t
 relation      |  9681826 | 11652 | AccessShareLock          | t
 relation      |    10969 | 21255 | AccessShareLock          | t
(12 Zeilen)

=============================================================================

Thank you
Regards,
Flo

Re: Force removing Locks

От
Tom Lane
Дата:
Florian Eberle <florian.eberle@gmail.com> writes:
> I've got a Problem... An Application that uses my Postgres Server always
> keeps some locks open... Is there a Possibility to forcing remove the
> Locks after a certain Interval or to remove them by hand?

Fix your application to close its transaction occasionally.  Leaving
a transaction open forever prevents vacuum from cleaning dead rows,
quite independently of any locking issues.

            regards, tom lane