Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite042678

Browse files
committed
Enhance pg_stat_reset_single_table_counters function.
This commit allows pg_stat_reset_single_table_counters() to reset statisticsfor a single relation shared across all databases in the cluster to zero.Bump catalog version.Author: B Sadhu Prasad PatroReviewed-by: Mahendra Singh Thalor, Himanshu Upadhyaya, Dilip Kumar, Fujii MasaoDiscussion:https://postgr.es/m/CAFF0-CGy7EHeF=AqqkGMF85cySPQBgDcvNk73G2O0vL94O5U5A@mail.gmail.com
1 parent31c389d commite042678

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5097,7 +5097,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
50975097
</para>
50985098
<para>
50995099
Resets statistics for a single table or index in the current database
5100-
to zero.
5100+
or shared across all databases in the clusterto zero.
51015101
</para>
51025102
<para>
51035103
This function is restricted to superusers by default, but other users

‎src/backend/postmaster/pgstat.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include"access/transam.h"
3939
#include"access/twophase_rmgr.h"
4040
#include"access/xact.h"
41+
#include"catalog/catalog.h"
4142
#include"catalog/pg_database.h"
4243
#include"catalog/pg_proc.h"
4344
#include"common/ip.h"
@@ -5140,15 +5141,19 @@ pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
51405141
/* ----------
51415142
* pgstat_recv_resetsinglecounter() -
51425143
*
5143-
*Reset a statistics for a single object
5144+
*Reset a statistics for a single object, which may be of current
5145+
*database or shared across all databases in the cluster.
51445146
* ----------
51455147
*/
51465148
staticvoid
51475149
pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter*msg,intlen)
51485150
{
51495151
PgStat_StatDBEntry*dbentry;
51505152

5151-
dbentry=pgstat_get_db_entry(msg->m_databaseid, false);
5153+
if (IsSharedRelation(msg->m_objectid))
5154+
dbentry=pgstat_get_db_entry(InvalidOid, false);
5155+
else
5156+
dbentry=pgstat_get_db_entry(msg->m_databaseid, false);
51525157

51535158
if (!dbentry)
51545159
return;

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO202108311
56+
#defineCATALOG_VERSION_NO202109021
5757

5858
#endif

‎src/include/catalog/pg_proc.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5754,7 +5754,7 @@
57545754
proname => 'pg_stat_reset_shared', provolatile => 'v', prorettype => 'void',
57555755
proargtypes => 'text', prosrc => 'pg_stat_reset_shared' },
57565756
{ oid => '3776',
5757-
descr => 'statistics: reset collected statistics for a single table or index in the current database',
5757+
descr => 'statistics: reset collected statistics for a single table or index in the current database or shared across all databases in the cluster',
57585758
proname => 'pg_stat_reset_single_table_counters', provolatile => 'v',
57595759
prorettype => 'void', proargtypes => 'oid',
57605760
prosrc => 'pg_stat_reset_single_table_counters' },

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp