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.
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@xxxxxxxxx>, 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.