Re: Blocking queries on a hot standby?

From: Rui DeSousa <rui(at)crazybean(dot)net>
To: Victor Sudakov <vas(at)sibptus(dot)ru>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Blocking queries on a hot standby?
Date: 2023-09-18 03:41:31
Message-ID: F1A25698-F203-48CB-ABED-3480FEF3A27F@crazybean.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Sep 15, 2023, at 12:30 AM, Victor Sudakov <vas(at)sibptus(dot)ru> wrote:
>
> Can you imagine, at least theoretically, any kind of query on a
> physical replica (hot standby) which would block other queries on the
> same replica?

The only thing that comes to mine is advisory locks and also queries can block replication replay.

prod=# select pg_is_in_recovery();
-[ RECORD 1 ]-----+--
pg_is_in_recovery | t

prod=# select * from blocked_session;
-[ RECORD 1 ]---+-----------------------------
pid | 39330
tree | 39330
root | 39330
level | 0
user | rui
state | idle
state_duration | 00:01:01.663597
wait_event_type | Client
wait_event | ClientRead
lockmode | ExclusiveLock
locktype | advisory
granted | t
lock_wait |
blocked | 1
query | select pg_advisory_lock(42);
objects |
-[ RECORD 2 ]---+-----------------------------
pid | 39327
tree | 39330.39327
root | 39330
level | 1
user | rui
state | active
state_duration | 00:00:51.407894
wait_event_type | Lock
wait_event | advisory
lockmode | ExclusiveLock
locktype | advisory
granted | f
lock_wait | 00:00:51.407746
blocked | 0
query | select pg_advisory_lock(42);
objects |

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Matt Gibbins 2023-09-18 22:04:33 Unable to drop extension dblink
Previous Message M Sarwar 2023-09-17 20:04:05 Re: Completely replacing an old user