[PG-644] Add option to disable application name tracking (#469)

* Cache application name for every backed instance

* Improve pg_get_backend_status performance for PG16 and PG17

* Fix

* Make application_name tracking disabled by default

* Meke app name tracking opt-out

* Format newly added code with pgindent

* Fix build for PG17

* Fix
This commit is contained in:
Artem Gavrilov
2024-07-23 18:49:33 +02:00
committed by GitHub
parent 16ec8362e2
commit d7999f1acf
10 changed files with 212 additions and 148 deletions

View File

@@ -24,4 +24,32 @@ SELECT pg_stat_monitor_reset();
(1 row)
SELECT 1 AS num;
num
-----
1
(1 row)
SET pg_stat_monitor.pgsm_track_application_names='no';
SELECT 1 AS num;
num
-----
1
(1 row)
SELECT query,application_name FROM pg_stat_monitor ORDER BY query, application_name COLLATE "C";
query | application_name
-------------------------------------------------------+-----------------------------
SELECT 1 AS num | pg_regress/application_name
SELECT 1 AS num |
SELECT pg_stat_monitor_reset() | pg_regress/application_name
SET pg_stat_monitor.pgsm_track_application_names='no' |
(4 rows)
SELECT pg_stat_monitor_reset();
pg_stat_monitor_reset
-----------------------
(1 row)
DROP EXTENSION pg_stat_monitor;