max number of locks

From: Fabio Pardi <f(dot)pardi(at)portavita(dot)eu>
To: pgsql-general(at)postgresql(dot)org
Subject: max number of locks
Date: 2015-07-03 10:14:17
Message-ID: 55966079.3060002@portavita.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

while experimenting with number of locks, i found something I cannot understand.

From what i can read in the documentation, at any one given time, a query can obtain a max number of locks given by

max_locks_per_transaction * (max_connections + max_prepared_transactions)

I then changed my db to use this settings:

mydb=# show max_locks_per_transaction ;
max_locks_per_transaction
---------------------------
20
(1 row)

mydb=# show max_connections ;
max_connections
-----------------
2
(1 row)

mydb=# show max_prepared_transactions ;
max_prepared_transactions
---------------------------
0
(1 row)

so i expected to be able to acquire a maximum of 40 locks.

Then:

mydb=# begin transaction ;
BEGIN
portavita=# SELECT 1 FROM root.ac;
?column?
----------
(0 rows)

mydb=# select count(*) from pg_locks ;
count
-------
132
(1 row)

Why can I acquire 132 locks while the expected number is 40? What am I doing wrong?

I m running Postgres 9.2.6

Thanks for your time,

Fabio


Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2015-07-03 10:15:23 Re: Backup Method
Previous Message howardnews@selestial.com 2015-07-03 09:59:49 Backup Method