Re: Any risk or overhead considerations for frequently executing queries against catalog tables?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Frits Hoogland <frits(dot)hoogland(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Any risk or overhead considerations for frequently executing queries against catalog tables?
Date: 2025-01-25 13:32:36
Message-ID: CAFj8pRANyuda5uf9KR4jY2dGYJ0SDDNhyjRWvnaCRkjffX-ydw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi

so 25. 1. 2025 v 12:23 odesílatel Frits Hoogland <frits(dot)hoogland(at)gmail(dot)com>
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*
>
>
>
>
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Edson Richter 2025-01-25 14:55:20 Read-only connectios optimizatios
Previous Message Frits Hoogland 2025-01-25 11:23:32 Any risk or overhead considerations for frequently executing queries against catalog tables?