max number of locks - Mailing list pgsql-general

From Fabio Pardi
Subject max number of locks
Date
Msg-id 55966079.3060002@portavita.eu
Whole thread Raw
Responses Re: max number of locks
List 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

 

pgsql-general by date:

Previous
From: "howardnews@selestial.com"
Date:
Subject: Backup Method
Next
From: Guillaume Lelarge
Date:
Subject: Re: Backup Method