Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS - Mailing list pgsql-performance

From Amine Tengilimoglu
Subject Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS
Date
Msg-id CADTdw-xLHkqwe9BqxN7wQozEuWPyav+wJjKt-W0bRtSH5uneXQ@mail.gmail.com
Whole thread Raw
In response to SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS  (aditya desai <admad123@gmail.com>)
List pgsql-performance
Hi;

It's normal to see locks on tables during queries. These are usually locks used automatically by postgres as a result of the operations you perform on your database. You should check the document for the lock modes postgres uses.

Lock causes slowness if it causes other queries to wait. You can see the queries waiting for lock from pg_locks view.  Access Exclusive Lock completely locks the table, does not allow read and write operations, blocks queries. 

Commands such as  drop table, truncate, reindex, vacuum full, alter table use this lock. And autovacuum  uses a weaker lock on the table, not using an exclusive lock.

aditya desai <admad123@gmail.com>, 4 Nis 2021 Paz, 13:42 tarihinde şunu yazdı:
Hi,
We have few select queries during which we see SHARED LOCKS and EXCLUSIVE LOCKS on tables. Can these locks cause slowness? Is there any way to reduce the locks?

What must be causing ACCESS EXCLUSIVE LOCKS when the application is running select queries? Is it AUTOVACUUM?

Regards,
Aditya.

pgsql-performance by date:

Previous
From: aditya desai
Date:
Subject: Re: SELECT Query taking 200 ms on PostgreSQL compared to 4 ms on Oracle after migration.
Next
From: Justin Pryzby
Date:
Subject: Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS