LCOV - code coverage report
Current view: top level - src/backend/utils/activity - pgstat_database.c (source / functions) Coverage Total Hit
Test: Code coverage Lines: 73.3 % 195 143
Test Date: 2026-01-26 10:56:24 Functions: 83.3 % 18 15
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 38.2 % 76 29

             Branch data     Line data    Source code
       1                 :             : /* -------------------------------------------------------------------------
       2                 :             :  *
       3                 :             :  * pgstat_database.c
       4                 :             :  *        Implementation of database statistics.
       5                 :             :  *
       6                 :             :  * This file contains the implementation of database statistics. It is kept
       7                 :             :  * separate from pgstat.c to enforce the line between the statistics access /
       8                 :             :  * storage implementation and the details about individual types of
       9                 :             :  * statistics.
      10                 :             :  *
      11                 :             :  * Copyright (c) 2001-2026, PostgreSQL Global Development Group
      12                 :             :  *
      13                 :             :  * IDENTIFICATION
      14                 :             :  *        src/backend/utils/activity/pgstat_database.c
      15                 :             :  * -------------------------------------------------------------------------
      16                 :             :  */
      17                 :             : 
      18                 :             : #include "postgres.h"
      19                 :             : 
      20                 :             : #include "storage/procsignal.h"
      21                 :             : #include "utils/pgstat_internal.h"
      22                 :             : #include "utils/timestamp.h"
      23                 :             : 
      24                 :             : 
      25                 :             : static bool pgstat_should_report_connstat(void);
      26                 :             : 
      27                 :             : 
      28                 :             : PgStat_Counter pgStatBlockReadTime = 0;
      29                 :             : PgStat_Counter pgStatBlockWriteTime = 0;
      30                 :             : PgStat_Counter pgStatActiveTime = 0;
      31                 :             : PgStat_Counter pgStatTransactionIdleTime = 0;
      32                 :             : SessionEndType pgStatSessionEndCause = DISCONNECT_NORMAL;
      33                 :             : 
      34                 :             : 
      35                 :             : static int      pgStatXactCommit = 0;
      36                 :             : static int      pgStatXactRollback = 0;
      37                 :             : static PgStat_Counter pgLastSessionReportTime = 0;
      38                 :             : 
      39                 :             : 
      40                 :             : /*
      41                 :             :  * Remove entry for the database being dropped.
      42                 :             :  */
      43                 :             : void
      44                 :           1 : pgstat_drop_database(Oid databaseid)
      45                 :             : {
      46                 :           1 :         pgstat_drop_transactional(PGSTAT_KIND_DATABASE, databaseid, InvalidOid);
      47                 :           1 : }
      48                 :             : 
      49                 :             : /*
      50                 :             :  * Called from autovacuum.c to report startup of an autovacuum process.
      51                 :             :  * We are called before InitPostgres is done, so can't rely on MyDatabaseId;
      52                 :             :  * the db OID must be passed in, instead.
      53                 :             :  */
      54                 :             : void
      55                 :           1 : pgstat_report_autovac(Oid dboid)
      56                 :             : {
      57                 :           1 :         PgStat_EntryRef *entry_ref;
      58                 :           1 :         PgStatShared_Database *dbentry;
      59                 :             : 
      60                 :             :         /* can't get here in single user mode */
      61         [ +  - ]:           1 :         Assert(IsUnderPostmaster);
      62                 :             : 
      63                 :             :         /*
      64                 :             :          * End-of-vacuum is reported instantly. Report the start the same way for
      65                 :             :          * consistency. Vacuum doesn't run frequently and is a long-lasting
      66                 :             :          * operation so it doesn't matter if we get blocked here a little.
      67                 :             :          */
      68                 :           1 :         entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_DATABASE,
      69                 :           1 :                                                                                         dboid, InvalidOid, false);
      70                 :             : 
      71                 :           1 :         dbentry = (PgStatShared_Database *) entry_ref->shared_stats;
      72                 :           1 :         dbentry->stats.last_autovac_time = GetCurrentTimestamp();
      73                 :             : 
      74                 :           1 :         pgstat_unlock_entry(entry_ref);
      75                 :           1 : }
      76                 :             : 
      77                 :             : /*
      78                 :             :  * Report a Hot Standby recovery conflict.
      79                 :             :  */
      80                 :             : void
      81                 :           0 : pgstat_report_recovery_conflict(int reason)
      82                 :             : {
      83                 :           0 :         PgStat_StatDBEntry *dbentry;
      84                 :             : 
      85         [ #  # ]:           0 :         Assert(IsUnderPostmaster);
      86         [ #  # ]:           0 :         if (!pgstat_track_counts)
      87                 :           0 :                 return;
      88                 :             : 
      89                 :           0 :         dbentry = pgstat_prep_database_pending(MyDatabaseId);
      90                 :             : 
      91   [ #  #  #  #  :           0 :         switch (reason)
                #  #  # ]
      92                 :             :         {
      93                 :             :                 case PROCSIG_RECOVERY_CONFLICT_DATABASE:
      94                 :             : 
      95                 :             :                         /*
      96                 :             :                          * Since we drop the information about the database as soon as it
      97                 :             :                          * replicates, there is no point in counting these conflicts.
      98                 :             :                          */
      99                 :             :                         break;
     100                 :             :                 case PROCSIG_RECOVERY_CONFLICT_TABLESPACE:
     101                 :           0 :                         dbentry->conflict_tablespace++;
     102                 :           0 :                         break;
     103                 :             :                 case PROCSIG_RECOVERY_CONFLICT_LOCK:
     104                 :           0 :                         dbentry->conflict_lock++;
     105                 :           0 :                         break;
     106                 :             :                 case PROCSIG_RECOVERY_CONFLICT_SNAPSHOT:
     107                 :           0 :                         dbentry->conflict_snapshot++;
     108                 :           0 :                         break;
     109                 :             :                 case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
     110                 :           0 :                         dbentry->conflict_bufferpin++;
     111                 :           0 :                         break;
     112                 :             :                 case PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT:
     113                 :           0 :                         dbentry->conflict_logicalslot++;
     114                 :           0 :                         break;
     115                 :             :                 case PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK:
     116                 :           0 :                         dbentry->conflict_startup_deadlock++;
     117                 :           0 :                         break;
     118                 :             :         }
     119         [ #  # ]:           0 : }
     120                 :             : 
     121                 :             : /*
     122                 :             :  * Report a detected deadlock.
     123                 :             :  */
     124                 :             : void
     125                 :           0 : pgstat_report_deadlock(void)
     126                 :             : {
     127                 :           0 :         PgStat_StatDBEntry *dbent;
     128                 :             : 
     129         [ #  # ]:           0 :         if (!pgstat_track_counts)
     130                 :           0 :                 return;
     131                 :             : 
     132                 :           0 :         dbent = pgstat_prep_database_pending(MyDatabaseId);
     133                 :           0 :         dbent->deadlocks++;
     134         [ #  # ]:           0 : }
     135                 :             : 
     136                 :             : /*
     137                 :             :  * Allow this backend to later report checksum failures for dboid, even if in
     138                 :             :  * a critical section at the time of the report.
     139                 :             :  *
     140                 :             :  * Without this function having been called first, the backend might need to
     141                 :             :  * allocate an EntryRef or might need to map in DSM segments. Neither should
     142                 :             :  * happen in a critical section.
     143                 :             :  */
     144                 :             : void
     145                 :        7053 : pgstat_prepare_report_checksum_failure(Oid dboid)
     146                 :             : {
     147         [ +  - ]:        7053 :         Assert(!CritSectionCount);
     148                 :             : 
     149                 :             :         /*
     150                 :             :          * Just need to ensure this backend has an entry ref for the database.
     151                 :             :          * That will allows us to report checksum failures without e.g. needing to
     152                 :             :          * map in DSM segments.
     153                 :             :          */
     154                 :        7053 :         pgstat_get_entry_ref(PGSTAT_KIND_DATABASE, dboid, InvalidOid,
     155                 :             :                                                  true, NULL);
     156                 :        7053 : }
     157                 :             : 
     158                 :             : /*
     159                 :             :  * Report one or more checksum failures.
     160                 :             :  *
     161                 :             :  * To be allowed to report checksum failures in critical sections, we require
     162                 :             :  * pgstat_prepare_report_checksum_failure() to have been called before this
     163                 :             :  * function is called.
     164                 :             :  */
     165                 :             : void
     166                 :           0 : pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
     167                 :             : {
     168                 :           0 :         PgStat_EntryRef *entry_ref;
     169                 :           0 :         PgStatShared_Database *sharedent;
     170                 :             : 
     171         [ #  # ]:           0 :         if (!pgstat_track_counts)
     172                 :           0 :                 return;
     173                 :             : 
     174                 :             :         /*
     175                 :             :          * Update the shared stats directly - checksum failures should never be
     176                 :             :          * common enough for that to be a problem. Note that we pass create=false
     177                 :             :          * here, as we want to be sure to not require memory allocations, so this
     178                 :             :          * can be called in critical sections.
     179                 :             :          */
     180                 :           0 :         entry_ref = pgstat_get_entry_ref(PGSTAT_KIND_DATABASE, dboid, InvalidOid,
     181                 :             :                                                                          false, NULL);
     182                 :             : 
     183                 :             :         /*
     184                 :             :          * Should always have been created by
     185                 :             :          * pgstat_prepare_report_checksum_failure().
     186                 :             :          *
     187                 :             :          * When not using assertions, we don't want to crash should something have
     188                 :             :          * gone wrong, so just return.
     189                 :             :          */
     190         [ #  # ]:           0 :         Assert(entry_ref);
     191         [ #  # ]:           0 :         if (!entry_ref)
     192                 :             :         {
     193   [ #  #  #  # ]:           0 :                 elog(WARNING, "could not report %d conflicts for DB %u",
     194                 :             :                          failurecount, dboid);
     195                 :           0 :                 return;
     196                 :             :         }
     197                 :             : 
     198                 :           0 :         (void) pgstat_lock_entry(entry_ref, false);
     199                 :             : 
     200                 :           0 :         sharedent = (PgStatShared_Database *) entry_ref->shared_stats;
     201                 :           0 :         sharedent->stats.checksum_failures += failurecount;
     202                 :           0 :         sharedent->stats.last_checksum_failure = GetCurrentTimestamp();
     203                 :             : 
     204                 :           0 :         pgstat_unlock_entry(entry_ref);
     205         [ #  # ]:           0 : }
     206                 :             : 
     207                 :             : /*
     208                 :             :  * Report creation of temporary file.
     209                 :             :  */
     210                 :             : void
     211                 :         933 : pgstat_report_tempfile(size_t filesize)
     212                 :             : {
     213                 :         933 :         PgStat_StatDBEntry *dbent;
     214                 :             : 
     215         [ +  - ]:         933 :         if (!pgstat_track_counts)
     216                 :           0 :                 return;
     217                 :             : 
     218                 :         933 :         dbent = pgstat_prep_database_pending(MyDatabaseId);
     219                 :         933 :         dbent->temp_bytes += filesize;
     220                 :         933 :         dbent->temp_files++;
     221         [ -  + ]:         933 : }
     222                 :             : 
     223                 :             : /*
     224                 :             :  * Notify stats system of a new connection.
     225                 :             :  */
     226                 :             : void
     227                 :         316 : pgstat_report_connect(Oid dboid)
     228                 :             : {
     229                 :         316 :         PgStat_StatDBEntry *dbentry;
     230                 :             : 
     231         [ +  + ]:         316 :         if (!pgstat_should_report_connstat())
     232                 :           1 :                 return;
     233                 :             : 
     234                 :         315 :         pgLastSessionReportTime = MyStartTimestamp;
     235                 :             : 
     236                 :         315 :         dbentry = pgstat_prep_database_pending(MyDatabaseId);
     237                 :         315 :         dbentry->sessions++;
     238         [ -  + ]:         316 : }
     239                 :             : 
     240                 :             : /*
     241                 :             :  * Notify the stats system of a disconnect.
     242                 :             :  */
     243                 :             : void
     244                 :         796 : pgstat_report_disconnect(Oid dboid)
     245                 :             : {
     246                 :         796 :         PgStat_StatDBEntry *dbentry;
     247                 :             : 
     248         [ +  + ]:         796 :         if (!pgstat_should_report_connstat())
     249                 :         481 :                 return;
     250                 :             : 
     251                 :         315 :         dbentry = pgstat_prep_database_pending(MyDatabaseId);
     252                 :             : 
     253   [ -  -  +  -  :         315 :         switch (pgStatSessionEndCause)
                      - ]
     254                 :             :         {
     255                 :             :                 case DISCONNECT_NOT_YET:
     256                 :             :                 case DISCONNECT_NORMAL:
     257                 :             :                         /* we don't collect these */
     258                 :         315 :                         break;
     259                 :             :                 case DISCONNECT_CLIENT_EOF:
     260                 :           0 :                         dbentry->sessions_abandoned++;
     261                 :           0 :                         break;
     262                 :             :                 case DISCONNECT_FATAL:
     263                 :           0 :                         dbentry->sessions_fatal++;
     264                 :           0 :                         break;
     265                 :             :                 case DISCONNECT_KILLED:
     266                 :           0 :                         dbentry->sessions_killed++;
     267                 :           0 :                         break;
     268                 :             :         }
     269         [ -  + ]:         796 : }
     270                 :             : 
     271                 :             : /*
     272                 :             :  * Support function for the SQL-callable pgstat* functions. Returns
     273                 :             :  * the collected statistics for one database or NULL. NULL doesn't mean
     274                 :             :  * that the database doesn't exist, just that there are no statistics, so the
     275                 :             :  * caller is better off to report ZERO instead.
     276                 :             :  */
     277                 :             : PgStat_StatDBEntry *
     278                 :          11 : pgstat_fetch_stat_dbentry(Oid dboid)
     279                 :             : {
     280                 :          11 :         return (PgStat_StatDBEntry *)
     281                 :          11 :                 pgstat_fetch_entry(PGSTAT_KIND_DATABASE, dboid, InvalidOid);
     282                 :             : }
     283                 :             : 
     284                 :             : void
     285                 :       57914 : AtEOXact_PgStat_Database(bool isCommit, bool parallel)
     286                 :             : {
     287                 :             :         /* Don't count parallel worker transaction stats */
     288         [ +  + ]:       57914 :         if (!parallel)
     289                 :             :         {
     290                 :             :                 /*
     291                 :             :                  * Count transaction commit or abort.  (We use counters, not just
     292                 :             :                  * bools, in case the reporting message isn't sent right away.)
     293                 :             :                  */
     294         [ +  + ]:       57437 :                 if (isCommit)
     295                 :       50423 :                         pgStatXactCommit++;
     296                 :             :                 else
     297                 :        7014 :                         pgStatXactRollback++;
     298                 :       57437 :         }
     299                 :       57914 : }
     300                 :             : 
     301                 :             : /*
     302                 :             :  * Notify the stats system about parallel worker information.
     303                 :             :  */
     304                 :             : void
     305                 :         115 : pgstat_update_parallel_workers_stats(PgStat_Counter workers_to_launch,
     306                 :             :                                                                          PgStat_Counter workers_launched)
     307                 :             : {
     308                 :         115 :         PgStat_StatDBEntry *dbentry;
     309                 :             : 
     310         [ +  - ]:         115 :         if (!OidIsValid(MyDatabaseId))
     311                 :           0 :                 return;
     312                 :             : 
     313                 :         115 :         dbentry = pgstat_prep_database_pending(MyDatabaseId);
     314                 :         115 :         dbentry->parallel_workers_to_launch += workers_to_launch;
     315                 :         115 :         dbentry->parallel_workers_launched += workers_launched;
     316         [ -  + ]:         115 : }
     317                 :             : 
     318                 :             : /*
     319                 :             :  * Subroutine for pgstat_report_stat(): Handle xact commit/rollback and I/O
     320                 :             :  * timings.
     321                 :             :  */
     322                 :             : void
     323                 :        1181 : pgstat_update_dbstats(TimestampTz ts)
     324                 :             : {
     325                 :        1181 :         PgStat_StatDBEntry *dbentry;
     326                 :             : 
     327                 :             :         /*
     328                 :             :          * If not connected to a database yet, don't attribute time to "shared
     329                 :             :          * state" (InvalidOid is used to track stats for shared relations, etc.).
     330                 :             :          */
     331         [ +  + ]:        1181 :         if (!OidIsValid(MyDatabaseId))
     332                 :           6 :                 return;
     333                 :             : 
     334                 :        1175 :         dbentry = pgstat_prep_database_pending(MyDatabaseId);
     335                 :             : 
     336                 :             :         /*
     337                 :             :          * Accumulate xact commit/rollback and I/O timings to stats entry of the
     338                 :             :          * current database.
     339                 :             :          */
     340                 :        1175 :         dbentry->xact_commit += pgStatXactCommit;
     341                 :        1175 :         dbentry->xact_rollback += pgStatXactRollback;
     342                 :        1175 :         dbentry->blk_read_time += pgStatBlockReadTime;
     343                 :        1175 :         dbentry->blk_write_time += pgStatBlockWriteTime;
     344                 :             : 
     345         [ +  + ]:        1175 :         if (pgstat_should_report_connstat())
     346                 :             :         {
     347                 :         693 :                 long            secs;
     348                 :         693 :                 int                     usecs;
     349                 :             : 
     350                 :             :                 /*
     351                 :             :                  * pgLastSessionReportTime is initialized to MyStartTimestamp by
     352                 :             :                  * pgstat_report_connect().
     353                 :             :                  */
     354                 :         693 :                 TimestampDifference(pgLastSessionReportTime, ts, &secs, &usecs);
     355                 :         693 :                 pgLastSessionReportTime = ts;
     356                 :         693 :                 dbentry->session_time += (PgStat_Counter) secs * 1000000 + usecs;
     357                 :         693 :                 dbentry->active_time += pgStatActiveTime;
     358                 :         693 :                 dbentry->idle_in_transaction_time += pgStatTransactionIdleTime;
     359                 :         693 :         }
     360                 :             : 
     361                 :        1175 :         pgStatXactCommit = 0;
     362                 :        1175 :         pgStatXactRollback = 0;
     363                 :        1175 :         pgStatBlockReadTime = 0;
     364                 :        1175 :         pgStatBlockWriteTime = 0;
     365                 :        1175 :         pgStatActiveTime = 0;
     366                 :        1175 :         pgStatTransactionIdleTime = 0;
     367         [ -  + ]:        1181 : }
     368                 :             : 
     369                 :             : /*
     370                 :             :  * We report session statistics only for normal backend processes.  Parallel
     371                 :             :  * workers run in parallel, so they don't contribute to session times, even
     372                 :             :  * though they use CPU time. Walsender processes could be considered here,
     373                 :             :  * but they have different session characteristics from normal backends (for
     374                 :             :  * example, they are always "active"), so they would skew session statistics.
     375                 :             :  */
     376                 :             : static bool
     377                 :        2287 : pgstat_should_report_connstat(void)
     378                 :             : {
     379                 :        2287 :         return MyBackendType == B_BACKEND;
     380                 :             : }
     381                 :             : 
     382                 :             : /*
     383                 :             :  * Find or create a local PgStat_StatDBEntry entry for dboid.
     384                 :             :  */
     385                 :             : PgStat_StatDBEntry *
     386                 :       47651 : pgstat_prep_database_pending(Oid dboid)
     387                 :             : {
     388                 :       47651 :         PgStat_EntryRef *entry_ref;
     389                 :             : 
     390                 :             :         /*
     391                 :             :          * This should not report stats on database objects before having
     392                 :             :          * connected to a database.
     393                 :             :          */
     394   [ +  +  +  - ]:       47651 :         Assert(!OidIsValid(dboid) || OidIsValid(MyDatabaseId));
     395                 :             : 
     396                 :       47651 :         entry_ref = pgstat_prep_pending_entry(PGSTAT_KIND_DATABASE, dboid, InvalidOid,
     397                 :             :                                                                                   NULL);
     398                 :             : 
     399                 :       95302 :         return entry_ref->pending;
     400                 :       47651 : }
     401                 :             : 
     402                 :             : /*
     403                 :             :  * Reset the database's reset timestamp, without resetting the contents of the
     404                 :             :  * database stats.
     405                 :             :  */
     406                 :             : void
     407                 :           3 : pgstat_reset_database_timestamp(Oid dboid, TimestampTz ts)
     408                 :             : {
     409                 :           3 :         PgStat_EntryRef *dbref;
     410                 :           3 :         PgStatShared_Database *dbentry;
     411                 :             : 
     412                 :           3 :         dbref = pgstat_get_entry_ref_locked(PGSTAT_KIND_DATABASE, MyDatabaseId, InvalidOid,
     413                 :             :                                                                                 false);
     414                 :             : 
     415                 :           3 :         dbentry = (PgStatShared_Database *) dbref->shared_stats;
     416                 :           3 :         dbentry->stats.stat_reset_timestamp = ts;
     417                 :             : 
     418                 :           3 :         pgstat_unlock_entry(dbref);
     419                 :           3 : }
     420                 :             : 
     421                 :             : /*
     422                 :             :  * Flush out pending stats for the entry
     423                 :             :  *
     424                 :             :  * If nowait is true and the lock could not be immediately acquired, returns
     425                 :             :  * false without flushing the entry.  Otherwise returns true.
     426                 :             :  */
     427                 :             : bool
     428                 :        2328 : pgstat_database_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
     429                 :             : {
     430                 :        2328 :         PgStatShared_Database *sharedent;
     431                 :        2328 :         PgStat_StatDBEntry *pendingent;
     432                 :             : 
     433                 :        2328 :         pendingent = (PgStat_StatDBEntry *) entry_ref->pending;
     434                 :        2328 :         sharedent = (PgStatShared_Database *) entry_ref->shared_stats;
     435                 :             : 
     436         [ -  + ]:        2328 :         if (!pgstat_lock_entry(entry_ref, nowait))
     437                 :           0 :                 return false;
     438                 :             : 
     439                 :             : #define PGSTAT_ACCUM_DBCOUNT(item)              \
     440                 :             :         (sharedent)->stats.item += (pendingent)->item
     441                 :             : 
     442                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(xact_commit);
     443                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(xact_rollback);
     444                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(blocks_fetched);
     445                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(blocks_hit);
     446                 :             : 
     447                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(tuples_returned);
     448                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(tuples_fetched);
     449                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(tuples_inserted);
     450                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(tuples_updated);
     451                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(tuples_deleted);
     452                 :             : 
     453                 :             :         /* last_autovac_time is reported immediately */
     454         [ +  - ]:        2328 :         Assert(pendingent->last_autovac_time == 0);
     455                 :             : 
     456                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_tablespace);
     457                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_lock);
     458                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_snapshot);
     459                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_logicalslot);
     460                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_bufferpin);
     461                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(conflict_startup_deadlock);
     462                 :             : 
     463                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(temp_bytes);
     464                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(temp_files);
     465                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(deadlocks);
     466                 :             : 
     467                 :             :         /* checksum failures are reported immediately */
     468         [ +  - ]:        2328 :         Assert(pendingent->checksum_failures == 0);
     469         [ +  - ]:        2328 :         Assert(pendingent->last_checksum_failure == 0);
     470                 :             : 
     471                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(blk_read_time);
     472                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(blk_write_time);
     473                 :             : 
     474                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(sessions);
     475                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(session_time);
     476                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(active_time);
     477                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(idle_in_transaction_time);
     478                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(sessions_abandoned);
     479                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(sessions_fatal);
     480                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(sessions_killed);
     481                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(parallel_workers_to_launch);
     482                 :        2328 :         PGSTAT_ACCUM_DBCOUNT(parallel_workers_launched);
     483                 :             : #undef PGSTAT_ACCUM_DBCOUNT
     484                 :             : 
     485                 :        2328 :         pgstat_unlock_entry(entry_ref);
     486                 :             : 
     487                 :        2328 :         memset(pendingent, 0, sizeof(*pendingent));
     488                 :             : 
     489                 :        2328 :         return true;
     490                 :        2328 : }
     491                 :             : 
     492                 :             : void
     493                 :           2 : pgstat_database_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts)
     494                 :             : {
     495                 :           2 :         ((PgStatShared_Database *) header)->stats.stat_reset_timestamp = ts;
     496                 :           2 : }
        

Generated by: LCOV version 2.3.2-1