mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-17 19:30:00 +08:00
Enhance pg_stat_reset_single_table_counters function.
This commit allows pg_stat_reset_single_table_counters() to reset statistics for a single relation shared across all databases in the cluster to zero. Bump catalog version. Author: B Sadhu Prasad Patro Reviewed-by: Mahendra Singh Thalor, Himanshu Upadhyaya, Dilip Kumar, Fujii Masao Discussion: https://postgr.es/m/CAFF0-CGy7EHeF=AqqkGMF85cySPQBgDcvNk73G2O0vL94O5U5A@mail.gmail.com
This commit is contained in:
parent
31c389d8de
commit
e04267844a
@ -5097,7 +5097,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
|
||||
</para>
|
||||
<para>
|
||||
Resets statistics for a single table or index in the current database
|
||||
to zero.
|
||||
or shared across all databases in the cluster to zero.
|
||||
</para>
|
||||
<para>
|
||||
This function is restricted to superusers by default, but other users
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "access/transam.h"
|
||||
#include "access/twophase_rmgr.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "catalog/pg_database.h"
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "common/ip.h"
|
||||
@ -5140,7 +5141,8 @@ pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
|
||||
/* ----------
|
||||
* pgstat_recv_resetsinglecounter() -
|
||||
*
|
||||
* Reset a statistics for a single object
|
||||
* Reset a statistics for a single object, which may be of current
|
||||
* database or shared across all databases in the cluster.
|
||||
* ----------
|
||||
*/
|
||||
static void
|
||||
@ -5148,7 +5150,10 @@ pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
|
||||
{
|
||||
PgStat_StatDBEntry *dbentry;
|
||||
|
||||
dbentry = pgstat_get_db_entry(msg->m_databaseid, false);
|
||||
if (IsSharedRelation(msg->m_objectid))
|
||||
dbentry = pgstat_get_db_entry(InvalidOid, false);
|
||||
else
|
||||
dbentry = pgstat_get_db_entry(msg->m_databaseid, false);
|
||||
|
||||
if (!dbentry)
|
||||
return;
|
||||
|
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 202108311
|
||||
#define CATALOG_VERSION_NO 202109021
|
||||
|
||||
#endif
|
||||
|
@ -5754,7 +5754,7 @@
|
||||
proname => 'pg_stat_reset_shared', provolatile => 'v', prorettype => 'void',
|
||||
proargtypes => 'text', prosrc => 'pg_stat_reset_shared' },
|
||||
{ oid => '3776',
|
||||
descr => 'statistics: reset collected statistics for a single table or index in the current database',
|
||||
descr => 'statistics: reset collected statistics for a single table or index in the current database or shared across all databases in the cluster',
|
||||
proname => 'pg_stat_reset_single_table_counters', provolatile => 'v',
|
||||
prorettype => 'void', proargtypes => 'oid',
|
||||
prosrc => 'pg_stat_reset_single_table_counters' },
|
||||
|
Loading…
Reference in New Issue
Block a user