</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
#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"
/* ----------
* 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
{
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;
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202108311
+#define CATALOG_VERSION_NO 202109021
#endif
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' },