public inbox for [email protected]
help / color / mirror / Atom feedFrom: shihao zhong <[email protected]>
To: Kirill Reshke <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Sami Imseih <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Add missing stats_reset column to pg_stat_database_conflicts view
Date: Tue, 10 Mar 2026 14:43:19 -0400
Message-ID: <CAGRkXqQ0qBHTcD=UZ7_GTLsgn+W-=1c8suMJ3yWZb2eP4m0fBg@mail.gmail.com> (raw)
In-Reply-To: <CALdSSPi4apueVqgnJEZqpy6O0HSEPUiUzf=vTLPPijsQLob2Eg@mail.gmail.com>
References: <CAGRkXqS98OebEWjax99_LVAECsxCB8i=BfsdAL34i-5QHfwyOQ@mail.gmail.com>
<CAA5RZ0vSjCEAuKXhxacnp0ftrYkf9QRcyPK-AvTi_otFVDWphA@mail.gmail.com>
<CAHGQGwEeGUQtj7TOznM2_O2uV-g6iOa1UBBTBfyugJ-nSoS89Q@mail.gmail.com>
<CALdSSPi4apueVqgnJEZqpy6O0HSEPUiUzf=vTLPPijsQLob2Eg@mail.gmail.com>
The patch has been rebased, and the documentation and catversion
updates have been added.
> I also noticed that pg_statio_all_sequences does not have a reset
> column. We should fix this one also. What do you think?
Right now the pg_statio_all_tables, pg_statio_all_indexes,
pg_statio_all_sequences, pg_stat_user_functions all do not have
reset_stat supported. I am actively working on tadd a reset_stat
support for these view. For now, let's quickly address the db conflict
first.
On Tue, Mar 10, 2026 at 7:32 AM Kirill Reshke <[email protected]> wrote:
>
> On Tue, 10 Mar 2026 at 06:17, Fujii Masao <[email protected]> wrote:
> >
> > On Tue, Mar 10, 2026 at 8:33 AM Sami Imseih <[email protected]> wrote:
> > >
> > > > The attached patch adds pg_stat_get_db_stat_reset_time() to fix this
> > > > inconsistency.
> > > >
> > > > Please let me know your thoughts.
> > >
> > > This view was introduced 15 years ago, and surprisingly this is the
> > > first complaint about this. I am also not very surprised.
> > >
> > > I also noticed that pg_statio_all_sequences does not have a reset
> > > column. We should fix this one also. What do you think?
> >
> > +1
> >
> > Also it might be better to update the docs together so that the description of
> > pg_stat_reset_single_table_counters mentions sequences in addition to
> > tables and indexes.
> >
> > Regards,
> >
> > --
> > Fujii Masao
> >
>
> Well, it looks like there are not so many users of this view. Anyway,
> +1 on change.
> This also need catversion bump
>
> --
> Best regards,
> Kirill Reshke
Attachments:
[application/octet-stream] pg_stat_database_conflicts_v2.patch (1.8K, 2-pg_stat_database_conflicts_v2.patch)
download | inline diff:
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 6878b2d..e8568c7 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -4030,2 +4030,11 @@
</row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>stats_reset</structfield> <type>timestamp with time zone</type>
+ </para>
+ <para>
+ Time at which these statistics were last reset
+ </para></entry>
+ </row>
</tbody>
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index a5d3e23..1552a92 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -1165,3 +1165,4 @@
pg_stat_get_db_conflict_startup_deadlock(D.oid) AS confl_deadlock,
- pg_stat_get_db_conflict_logicalslot(D.oid) AS confl_active_logicalslot
+ pg_stat_get_db_conflict_logicalslot(D.oid) AS confl_active_logicalslot,
+ pg_stat_get_db_stat_reset_time(D.oid) AS stats_reset
FROM pg_database D;
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index dfd7b14..a459343 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -59,3 +59,3 @@
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202603062
+#define CATALOG_VERSION_NO 202603101
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 05307a5..831a2c9 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -1924,2 +1924,3 @@
- pg_stat_get_db_conflict_logicalslot(oid) AS confl_active_logicalslot
+ pg_stat_get_db_conflict_logicalslot(oid) AS confl_active_logicalslot,
+ pg_stat_get_db_stat_reset_time(oid) AS stats_reset
FROM pg_database d;
view thread (24+ 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], [email protected]
Subject: Re: Add missing stats_reset column to pg_stat_database_conflicts view
In-Reply-To: <CAGRkXqQ0qBHTcD=UZ7_GTLsgn+W-=1c8suMJ3yWZb2eP4m0fBg@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