Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS

From: Amine Tengilimoglu <aminetengilimoglu(at)gmail(dot)com>
To: aditya desai <admad123(at)gmail(dot)com>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS
Date: 2021-04-04 17:01:27
Message-ID: CADTdw-xLHkqwe9BqxN7wQozEuWPyav+wJjKt-W0bRtSH5uneXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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.
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2021-04-04 17:19:45 Re: SHARED LOCKS , EXCLUSIVE LOCKS, ACCESS EXCLUSIVE LOCKS
Previous Message aditya desai 2021-04-04 11:10:33 Re: SELECT Query taking 200 ms on PostgreSQL compared to 4 ms on Oracle after migration.