Re: Adding locks statistics
От | Greg Sabino Mullane |
---|---|
Тема | Re: Adding locks statistics |
Дата | |
Msg-id | CAKAnmm+USTr5MeKuyrAvbCjHqbSFbZ+czJsV7fPYt9nECQkf-A@mail.gmail.com обсуждение исходный текст |
Ответ на | Adding locks statistics (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>) |
Ответы |
Re: Adding locks statistics
Re: Adding locks statistics |
Список | pgsql-hackers |
Great idea. +1. Here is a quick overall review to get things started.
Meta:
patch did not apply via "git apply". Also has carriage returns (e.g. DOS file), and some errant whitespace. Seems to pass pgindent, though.
Name:
I think the name would read better as pg_stat_locks, especially as it returns multiple rows.
Docs: seem good. Needs a section on how to reset via
SELECT pg_stat_reset_shared('lock');
Also plural better here ('locks')
Code:
+ * Copyright (c) 2021-2025, PostgreSQL Global Development Group
If a new file, we can simply say 2025?
+ LWLock locks[LOCKTAG_LAST_TYPE + 1];
+ PgStat_Lock stats;
Adding a lock to the system that counts locks! :) (just found amusing, not a comment)
-#define PGSTAT_KIND_SLRU 11
-#define PGSTAT_KIND_WAL 12
+#define PGSTAT_KIND_LOCK 11
+#define PGSTAT_KIND_SLRU 12
+#define PGSTAT_KIND_WAL 13
Why not just add LOCK as #13?
What about the overhead of maintaining this system? I know it's overall very lightweight, but from my testing, the relation locktype in particular is very, very busy. Busier than I realized until I saw it in this useful view!
Meta:
patch did not apply via "git apply". Also has carriage returns (e.g. DOS file), and some errant whitespace. Seems to pass pgindent, though.
Name:
I think the name would read better as pg_stat_locks, especially as it returns multiple rows.
Docs: seem good. Needs a section on how to reset via
SELECT pg_stat_reset_shared('lock');
Also plural better here ('locks')
Code:
+ * Copyright (c) 2021-2025, PostgreSQL Global Development Group
If a new file, we can simply say 2025?
+ LWLock locks[LOCKTAG_LAST_TYPE + 1];
+ PgStat_Lock stats;
Adding a lock to the system that counts locks! :) (just found amusing, not a comment)
-#define PGSTAT_KIND_SLRU 11
-#define PGSTAT_KIND_WAL 12
+#define PGSTAT_KIND_LOCK 11
+#define PGSTAT_KIND_SLRU 12
+#define PGSTAT_KIND_WAL 13
Why not just add LOCK as #13?
What about the overhead of maintaining this system? I know it's overall very lightweight, but from my testing, the relation locktype in particular is very, very busy. Busier than I realized until I saw it in this useful view!
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
В списке pgsql-hackers по дате отправления: