public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pavel Stehule <[email protected]>
To: Frits Hoogland <[email protected]>
Cc: [email protected]
Subject: Re: Any risk or overhead considerations for frequently executing queries against catalog tables?
Date: Sat, 25 Jan 2025 14:32:36 +0100
Message-ID: <CAFj8pRANyuda5uf9KR4jY2dGYJ0SDDNhyjRWvnaCRkjffX-ydw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Hi

so 25. 1. 2025 v 12:23 odesílatel Frits Hoogland <[email protected]>
napsal:

> For monitoring database behaviour and trying to build an history of
> activity, if I would create an application that creates a single connection
> and execute something like:
> select * from pg_stat_activity;
> select * from pg_stat_database;
> select * from pg_stat_bgwriter;
> select * from pg_stat_wal;
> select * from pg_settings;
> select * from pg_database;
> For which the query is prepared, and execute that every 1 second, would
> there be any realistic danger or overhead that should be considered?
> My thinking is that the data for these catalogs are all in shared memory
> and when executed serially and do not cause any significant resources to be
> taken?
>

The queries to all tables excluding pg_database every 1 sec will have
probably zero impact to performance.

I am not sure about pg_database - it is a very important table, and your
query can block operations that need exclusive lock to this table. So
theoretically, there can be some impact to performance.

Regards

Pavel


>
> Thanks,
>
> *Frits Hoogland*
>
>
>
>
>


view thread (9+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Any risk or overhead considerations for frequently executing queries against catalog tables?
  In-Reply-To: <CAFj8pRANyuda5uf9KR4jY2dGYJ0SDDNhyjRWvnaCRkjffX-ydw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox