From: Scott Ribe <scott_ribe@elevated-dev.com>
To: pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: system catalog performance
Date: Fri, 1 Oct 2021 08:21:43 -0600
Message-ID: <3DA944AB-CCDB-4A74-8562-691D02FD0F2E@elevated-dev.com> (raw)
Under what circumstances would the following query be extra slow?
SELECT
pg_catalog.to_char(pg_catalog.pg_postmaster_start_time(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'),
CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE ('x' || pg_catalog.substr(pg_catalog.pg_walfile_name(pg_catalog.pg_current_wal_lsn()), 1, 8))::bit(32)::int END,
CASE WHEN pg_catalog.pg_is_in_recovery() THEN 0 ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), '0/0')::bigint END,
pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_replay_lsn(), '0/0')::bigint,
pg_catalog.pg_wal_lsn_diff(COALESCE(pg_catalog.pg_last_wal_receive_lsn(), '0/0'), '0/0')::bigint,
pg_catalog.pg_is_in_recovery() AND pg_catalog.pg_is_wal_replay_paused(),
pg_catalog.to_char(pg_catalog.pg_last_xact_replay_timestamp(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'),
pg_catalog.array_to_json(pg_catalog.array_agg(pg_catalog.row_to_json(ri)))
FROM (
SELECT
(SELECT rolname FROM pg_authid WHERE oid = usesysid) AS usename,
application_name,
client_addr,
w.state,
sync_state,
sync_priority
FROM pg_catalog.pg_stat_get_wal_senders() w, pg_catalog.pg_stat_get_activity(pid)
) as ri;
This is regarding Patroni--I haven't yet dug into that source to see how long that timeout is. PG 13.3, monitoring did not show heavy load nor unusual lock activity around when this happened.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott_ribe@elevated-dev.com, pgsql-admin@lists.postgresql.org
Subject: Re: system catalog performance
In-Reply-To: <3DA944AB-CCDB-4A74-8562-691D02FD0F2E@elevated-dev.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox