PostgreSQL Source Code  git master
pgstat.h
Go to the documentation of this file.
1 /* ----------
2  * pgstat.h
3  *
4  * Definitions for the PostgreSQL statistics collector daemon.
5  *
6  * Copyright (c) 2001-2021, PostgreSQL Global Development Group
7  *
8  * src/include/pgstat.h
9  * ----------
10  */
11 #ifndef PGSTAT_H
12 #define PGSTAT_H
13 
14 #include "datatype/timestamp.h"
15 #include "portability/instr_time.h"
16 #include "postmaster/pgarch.h" /* for MAX_XFN_CHARS */
18 #include "utils/backend_progress.h" /* for backward compatibility */
19 #include "utils/backend_status.h" /* for backward compatibility */
20 #include "utils/hsearch.h"
21 #include "utils/relcache.h"
22 #include "utils/wait_event.h" /* for backward compatibility */
23 
24 
25 /* ----------
26  * Paths for the statistics files (relative to installation's $PGDATA).
27  * ----------
28  */
29 #define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat"
30 #define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/global.stat"
31 #define PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/global.tmp"
32 
33 /* Default directory to store temporary statistics data in */
34 #define PG_STAT_TMP_DIR "pg_stat_tmp"
35 
36 /* Values for track_functions GUC variable --- order is significant! */
37 typedef enum TrackFunctionsLevel
38 {
43 
44 /* Values to track the cause of session termination */
45 typedef enum SessionEndType
46 {
47  DISCONNECT_NOT_YET, /* still active */
53 
54 /* ----------
55  * The types of backend -> collector messages
56  * ----------
57  */
58 typedef enum StatMsgType
59 {
90 
91 /* ----------
92  * The data type used for counters.
93  * ----------
94  */
95 typedef int64 PgStat_Counter;
96 
97 /* ----------
98  * PgStat_TableCounts The actual per-table counts kept by a backend
99  *
100  * This struct should contain only actual event counters, because we memcmp
101  * it against zeroes to detect whether there are any counts to transmit.
102  * It is a component of PgStat_TableStatus (within-backend state) and
103  * PgStat_TableEntry (the transmitted message format).
104  *
105  * Note: for a table, tuples_returned is the number of tuples successfully
106  * fetched by heap_getnext, while tuples_fetched is the number of tuples
107  * successfully fetched by heap_fetch under the control of bitmap indexscans.
108  * For an index, tuples_returned is the number of index entries returned by
109  * the index AM, while tuples_fetched is the number of tuples successfully
110  * fetched by heap_fetch under the control of simple indexscans for this index.
111  *
112  * tuples_inserted/updated/deleted/hot_updated count attempted actions,
113  * regardless of whether the transaction committed. delta_live_tuples,
114  * delta_dead_tuples, and changed_tuples are set depending on commit or abort.
115  * Note that delta_live_tuples and delta_dead_tuples can be negative!
116  * ----------
117  */
118 typedef struct PgStat_TableCounts
119 {
121 
124 
130 
134 
138 
139 /* Possible targets for resetting cluster-wide shared values */
141 {
144  RESET_WAL
146 
147 /* Possible object types for resetting single counters */
149 {
154 
155 /* ------------------------------------------------------------
156  * Structures kept in backend local memory while accumulating counts
157  * ------------------------------------------------------------
158  */
159 
160 
161 /* ----------
162  * PgStat_TableStatus Per-table status within a backend
163  *
164  * Many of the event counters are nontransactional, ie, we count events
165  * in committed and aborted transactions alike. For these, we just count
166  * directly in the PgStat_TableStatus. However, delta_live_tuples,
167  * delta_dead_tuples, and changed_tuples must be derived from event counts
168  * with awareness of whether the transaction or subtransaction committed or
169  * aborted. Hence, we also keep a stack of per-(sub)transaction status
170  * records for every table modified in the current transaction. At commit
171  * or abort, we propagate tuples_inserted/updated/deleted up to the
172  * parent subtransaction level, or out to the parent PgStat_TableStatus,
173  * as appropriate.
174  * ----------
175  */
176 typedef struct PgStat_TableStatus
177 {
178  Oid t_id; /* table's OID */
179  bool t_shared; /* is it a shared catalog? */
180  struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */
181  PgStat_TableCounts t_counts; /* event counts to be sent */
183 
184 /* ----------
185  * PgStat_TableXactStatus Per-table, per-subtransaction status
186  * ----------
187  */
189 {
190  PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
191  PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
192  PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
193  bool truncdropped; /* relation truncated/dropped in this
194  * (sub)xact */
195  /* tuples i/u/d prior to truncate/drop */
199  int nest_level; /* subtransaction nest level */
200  /* links to other structs for same relation: */
201  struct PgStat_TableXactStatus *upper; /* next higher subxact if any */
202  PgStat_TableStatus *parent; /* per-table status */
203  /* structs of same subxact level are linked here: */
204  struct PgStat_TableXactStatus *next; /* next of same subxact */
206 
207 
208 /* ------------------------------------------------------------
209  * Message formats follow
210  * ------------------------------------------------------------
211  */
212 
213 
214 /* ----------
215  * PgStat_MsgHdr The common message header
216  * ----------
217  */
218 typedef struct PgStat_MsgHdr
219 {
221  int m_size;
223 
224 /* ----------
225  * Space available in a message. This will keep the UDP packets below 1K,
226  * which should fit unfragmented into the MTU of the loopback interface.
227  * (Larger values of PGSTAT_MAX_MSG_SIZE would work for that on most
228  * platforms, but we're being conservative here.)
229  * ----------
230  */
231 #define PGSTAT_MAX_MSG_SIZE 1000
232 #define PGSTAT_MSG_PAYLOAD (PGSTAT_MAX_MSG_SIZE - sizeof(PgStat_MsgHdr))
233 
234 
235 /* ----------
236  * PgStat_MsgDummy A dummy message, ignored by the collector
237  * ----------
238  */
239 typedef struct PgStat_MsgDummy
240 {
243 
244 
245 /* ----------
246  * PgStat_MsgInquiry Sent by a backend to ask the collector
247  * to write the stats file(s).
248  *
249  * Ordinarily, an inquiry message prompts writing of the global stats file,
250  * the stats file for shared catalogs, and the stats file for the specified
251  * database. If databaseid is InvalidOid, only the first two are written.
252  *
253  * New file(s) will be written only if the existing file has a timestamp
254  * older than the specified cutoff_time; this prevents duplicated effort
255  * when multiple requests arrive at nearly the same time, assuming that
256  * backends send requests with cutoff_times a little bit in the past.
257  *
258  * clock_time should be the requestor's current local time; the collector
259  * uses this to check for the system clock going backward, but it has no
260  * effect unless that occurs. We assume clock_time >= cutoff_time, though.
261  * ----------
262  */
263 
264 typedef struct PgStat_MsgInquiry
265 {
267  TimestampTz clock_time; /* observed local clock time */
268  TimestampTz cutoff_time; /* minimum acceptable file timestamp */
269  Oid databaseid; /* requested DB (InvalidOid => shared only) */
271 
272 
273 /* ----------
274  * PgStat_TableEntry Per-table info in a MsgTabstat
275  * ----------
276  */
277 typedef struct PgStat_TableEntry
278 {
282 
283 /* ----------
284  * PgStat_MsgTabstat Sent by the backend to report table
285  * and buffer access statistics.
286  * ----------
287  */
288 #define PGSTAT_NUM_TABENTRIES \
289  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int) - 5 * sizeof(PgStat_Counter)) \
290  / sizeof(PgStat_TableEntry))
291 
292 typedef struct PgStat_MsgTabstat
293 {
299  PgStat_Counter m_block_read_time; /* times in microseconds */
306 
307 
308 /* ----------
309  * PgStat_MsgTabpurge Sent by the backend to tell the collector
310  * about dead tables.
311  * ----------
312  */
313 #define PGSTAT_NUM_TABPURGE \
314  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
315  / sizeof(Oid))
316 
317 typedef struct PgStat_MsgTabpurge
318 {
324 
325 
326 /* ----------
327  * PgStat_MsgDropdb Sent by the backend to tell the collector
328  * about a dropped database
329  * ----------
330  */
331 typedef struct PgStat_MsgDropdb
332 {
336 
337 
338 /* ----------
339  * PgStat_MsgResetcounter Sent by the backend to tell the collector
340  * to reset counters
341  * ----------
342  */
344 {
348 
349 /* ----------
350  * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector
351  * to reset a shared counter
352  * ----------
353  */
355 {
359 
360 /* ----------
361  * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector
362  * to reset a single counter
363  * ----------
364  */
366 {
373 
374 /* ----------
375  * PgStat_MsgResetslrucounter Sent by the backend to tell the collector
376  * to reset a SLRU counter
377  * ----------
378  */
380 {
382  int m_index;
384 
385 /* ----------
386  * PgStat_MsgResetreplslotcounter Sent by the backend to tell the collector
387  * to reset replication slot counter(s)
388  * ----------
389  */
391 {
394  bool clearall;
396 
397 /* ----------
398  * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal
399  * that a database is going to be processed
400  * ----------
401  */
403 {
408 
409 
410 /* ----------
411  * PgStat_MsgVacuum Sent by the backend or autovacuum daemon
412  * after VACUUM
413  * ----------
414  */
415 typedef struct PgStat_MsgVacuum
416 {
425 
426 
427 /* ----------
428  * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon
429  * after ANALYZE
430  * ----------
431  */
432 typedef struct PgStat_MsgAnalyze
433 {
443 
444 
445 /* ----------
446  * PgStat_MsgArchiver Sent by the archiver to update statistics.
447  * ----------
448  */
449 typedef struct PgStat_MsgArchiver
450 {
452  bool m_failed; /* Failed attempt */
456 
457 /* ----------
458  * PgStat_MsgBgWriter Sent by the bgwriter to update statistics.
459  * ----------
460  */
461 typedef struct PgStat_MsgBgWriter
462 {
464 
469 
470 /* ----------
471  * PgStat_MsgCheckpointer Sent by the checkpointer to update statistics.
472  * ----------
473  */
475 {
477 
483  PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */
486 
487 /* ----------
488  * PgStat_MsgWal Sent by backends and background processes to update WAL statistics.
489  * ----------
490  */
491 typedef struct PgStat_MsgWal
492 {
496  uint64 m_wal_bytes;
500  PgStat_Counter m_wal_write_time; /* time spent writing wal records in
501  * microseconds */
502  PgStat_Counter m_wal_sync_time; /* time spent syncing wal records in
503  * microseconds */
505 
506 /* ----------
507  * PgStat_MsgSLRU Sent by a backend to update SLRU statistics.
508  * ----------
509  */
510 typedef struct PgStat_MsgSLRU
511 {
522 
523 /* ----------
524  * PgStat_MsgReplSlot Sent by a backend or a wal sender to update replication
525  * slot statistics.
526  * ----------
527  */
528 typedef struct PgStat_MsgReplSlot
529 {
532  bool m_create;
533  bool m_drop;
543 
544 /* ----------
545  * PgStat_MsgSubscriptionPurge Sent by the backend and autovacuum to tell the
546  * collector about the dead subscriptions.
547  * ----------
548  */
549 #define PGSTAT_NUM_SUBSCRIPTIONPURGE \
550  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) / sizeof(Oid))
551 
553 {
559 
560 /* ----------
561  * PgStat_MsgSubWorkerError Sent by the apply worker or the table sync
562  * worker to report the error occurred while
563  * processing changes.
564  * ----------
565  */
566 #define PGSTAT_SUBWORKERERROR_MSGLEN 256
568 {
570 
571  /*
572  * m_subid and m_subrelid are used to determine the subscription and the
573  * reporter of the error. m_subrelid is InvalidOid if reported by an apply
574  * worker otherwise reported by a table sync worker.
575  */
579 
580  /*
581  * Oid of the table that the reporter was actually processing. m_relid can
582  * be InvalidOid if an error occurred during worker applying a
583  * non-data-modification message such as RELATION.
584  */
586 
592 
593 /* ----------
594  * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict
595  * ----------
596  */
598 {
600 
602  int m_reason;
604 
605 /* ----------
606  * PgStat_MsgTempFile Sent by the backend upon creating a temp file
607  * ----------
608  */
609 typedef struct PgStat_MsgTempFile
610 {
612 
614  size_t m_filesize;
616 
617 /* ----------
618  * PgStat_FunctionCounts The actual per-function counts kept by a backend
619  *
620  * This struct should contain only actual event counters, because we memcmp
621  * it against zeroes to detect whether there are any counts to transmit.
622  *
623  * Note that the time counters are in instr_time format here. We convert to
624  * microseconds in PgStat_Counter format when transmitting to the collector.
625  * ----------
626  */
627 typedef struct PgStat_FunctionCounts
628 {
633 
634 /* ----------
635  * PgStat_BackendFunctionEntry Entry in backend's per-function hash table
636  * ----------
637  */
639 {
643 
644 /* ----------
645  * PgStat_FunctionEntry Per-function info in a MsgFuncstat
646  * ----------
647  */
648 typedef struct PgStat_FunctionEntry
649 {
652  PgStat_Counter f_total_time; /* times in microseconds */
655 
656 /* ----------
657  * PgStat_MsgFuncstat Sent by the backend to report function
658  * usage statistics.
659  * ----------
660  */
661 #define PGSTAT_NUM_FUNCENTRIES \
662  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
663  / sizeof(PgStat_FunctionEntry))
664 
665 typedef struct PgStat_MsgFuncstat
666 {
672 
673 /* ----------
674  * PgStat_MsgFuncpurge Sent by the backend to tell the collector
675  * about dead functions.
676  * ----------
677  */
678 #define PGSTAT_NUM_FUNCPURGE \
679  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
680  / sizeof(Oid))
681 
682 typedef struct PgStat_MsgFuncpurge
683 {
689 
690 /* ----------
691  * PgStat_MsgDeadlock Sent by the backend to tell the collector
692  * about a deadlock that occurred.
693  * ----------
694  */
695 typedef struct PgStat_MsgDeadlock
696 {
700 
701 /* ----------
702  * PgStat_MsgChecksumFailure Sent by the backend to tell the collector
703  * about checksum failures noticed.
704  * ----------
705  */
707 {
713 
714 /* ----------
715  * PgStat_MsgConnect Sent by the backend upon connection
716  * establishment
717  * ----------
718  */
719 typedef struct PgStat_MsgConnect
720 {
724 
725 /* ----------
726  * PgStat_MsgDisconnect Sent by the backend when disconnecting
727  * ----------
728  */
729 typedef struct PgStat_MsgDisconnect
730 {
735 
736 /* ----------
737  * PgStat_Msg Union over all possible messages.
738  * ----------
739  */
740 typedef union PgStat_Msg
741 {
773 
774 
775 /* ------------------------------------------------------------
776  * Statistic collector data structures follow
777  *
778  * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these
779  * data structures change.
780  * ------------------------------------------------------------
781  */
782 
783 #define PGSTAT_FILE_FORMAT_ID 0x01A5BCA5
784 
785 /* ----------
786  * PgStat_StatDBEntry The collector's data per database
787  * ----------
788  */
789 typedef struct PgStat_StatDBEntry
790 {
812  PgStat_Counter n_block_read_time; /* times in microseconds */
821 
823  TimestampTz stats_timestamp; /* time of db stats file update */
824 
825  /*
826  * tables, functions, and subscription workers must be last in the struct,
827  * because we don't write the pointers out to the stats file.
828  *
829  * subworkers is the hash table of PgStat_StatSubWorkerEntry which stores
830  * statistics of logical replication workers: apply worker and table sync
831  * worker.
832  */
837 
838 
839 /* ----------
840  * PgStat_StatTabEntry The collector's data per table (or index)
841  * ----------
842  */
843 typedef struct PgStat_StatTabEntry
844 {
846 
848 
851 
856 
861 
864 
865  TimestampTz vacuum_timestamp; /* user initiated vacuum */
867  TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */
869  TimestampTz analyze_timestamp; /* user initiated */
871  TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */
874 
875 
876 /* ----------
877  * PgStat_StatFuncEntry The collector's data per function
878  * ----------
879  */
880 typedef struct PgStat_StatFuncEntry
881 {
883 
885 
886  PgStat_Counter f_total_time; /* times in microseconds */
889 
890 
891 /*
892  * Archiver statistics kept in the stats collector
893  */
894 typedef struct PgStat_ArchiverStats
895 {
896  PgStat_Counter archived_count; /* archival successes */
897  char last_archived_wal[MAX_XFN_CHARS + 1]; /* last WAL file
898  * archived */
899  TimestampTz last_archived_timestamp; /* last archival success time */
900  PgStat_Counter failed_count; /* failed archival attempts */
901  char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in
902  * last failure */
903  TimestampTz last_failed_timestamp; /* last archival failure time */
906 
907 /*
908  * Background writer statistics kept in the stats collector
909  */
910 typedef struct PgStat_BgWriterStats
911 {
917 
918 /*
919  * Checkpointer statistics kept in the stats collector
920  */
922 {
923  TimestampTz stats_timestamp; /* time of stats file update */
926  PgStat_Counter checkpoint_write_time; /* times in milliseconds */
932 
933 /*
934  * Global statistics kept in the stats collector
935  */
936 typedef struct PgStat_GlobalStats
937 {
938  TimestampTz stats_timestamp; /* time of stats file update */
939 
943 
944 /*
945  * WAL statistics kept in the stats collector
946  */
947 typedef struct PgStat_WalStats
948 {
951  uint64 wal_bytes;
959 
960 /*
961  * SLRU statistics kept in the stats collector
962  */
963 typedef struct PgStat_SLRUStats
964 {
974 
975 /*
976  * Replication slot statistics kept in the stats collector
977  */
979 {
991 
992 /* The lookup key for subscription worker hash table */
994 {
996 
997  /*
998  * Oid of the table for which tablesync worker will copy the initial data.
999  * An InvalidOid will be assigned for apply workers.
1000  */
1003 
1004 /*
1005  * Logical replication apply worker and table sync worker statistics kept in the
1006  * stats collector.
1007  */
1009 {
1010  PgStat_StatSubWorkerKey key; /* hash key (must be first) */
1011 
1012  /*
1013  * Subscription worker error statistics representing an error that
1014  * occurred during application of changes or the initial table
1015  * synchronization.
1016  */
1024 
1025 /*
1026  * Working state needed to accumulate per-function-call timing statistics.
1027  */
1029 {
1030  /* Link to function's hashtable entry (must still be there at exit!) */
1031  /* NULL means we are not tracking the current function call */
1033  /* Total time previously charged to function, as of function start */
1035  /* Backend-wide total time as of function start */
1037  /* system clock as of function start */
1040 
1041 
1042 /* ----------
1043  * GUC parameters
1044  * ----------
1045  */
1046 extern PGDLLIMPORT bool pgstat_track_counts;
1048 extern char *pgstat_stat_directory;
1049 extern char *pgstat_stat_tmpname;
1050 extern char *pgstat_stat_filename;
1051 
1052 /*
1053  * BgWriter statistics counters are updated directly by bgwriter and bufmgr
1054  */
1056 
1057 /*
1058  * Checkpointer statistics counters are updated directly by checkpointer and
1059  * bufmgr.
1060  */
1062 
1063 /*
1064  * WAL statistics counter is updated by backends and background processes
1065  */
1066 extern PgStat_MsgWal WalStats;
1067 
1068 /*
1069  * Updated by pgstat_count_buffer_*_time macros
1070  */
1073 
1074 /*
1075  * Updated by pgstat_count_conn_*_time macros, called by
1076  * pgstat_report_activity().
1077  */
1080 
1081 
1082 /*
1083  * Updated by the traffic cop and in errfinish()
1084  */
1086 
1087 /* ----------
1088  * Functions called from postmaster
1089  * ----------
1090  */
1091 extern void pgstat_init(void);
1092 extern int pgstat_start(void);
1093 extern void pgstat_reset_all(void);
1094 extern void allow_immediate_pgstat_restart(void);
1095 
1096 #ifdef EXEC_BACKEND
1097 extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn();
1098 #endif
1099 
1100 
1101 /* ----------
1102  * Functions called from backends
1103  * ----------
1104  */
1105 extern void pgstat_ping(void);
1106 
1107 extern void pgstat_report_stat(bool force);
1108 extern void pgstat_vacuum_stat(void);
1109 extern void pgstat_drop_database(Oid databaseid);
1110 
1111 extern void pgstat_clear_snapshot(void);
1112 extern void pgstat_reset_counters(void);
1113 extern void pgstat_reset_shared_counters(const char *);
1114 extern void pgstat_reset_single_counter(Oid objectid, Oid subobjectid,
1116 extern void pgstat_reset_slru_counter(const char *);
1117 extern void pgstat_reset_replslot_counter(const char *name);
1118 
1119 extern void pgstat_report_connect(Oid dboid);
1120 extern void pgstat_report_autovac(Oid dboid);
1121 extern void pgstat_report_vacuum(Oid tableoid, bool shared,
1122  PgStat_Counter livetuples, PgStat_Counter deadtuples);
1123 extern void pgstat_report_analyze(Relation rel,
1124  PgStat_Counter livetuples, PgStat_Counter deadtuples,
1125  bool resetcounter);
1126 
1127 extern void pgstat_report_recovery_conflict(int reason);
1128 extern void pgstat_report_deadlock(void);
1129 extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount);
1130 extern void pgstat_report_checksum_failure(void);
1131 extern void pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat);
1132 extern void pgstat_report_replslot_create(const char *slotname);
1133 extern void pgstat_report_replslot_drop(const char *slotname);
1134 extern void pgstat_report_subworker_error(Oid subid, Oid subrelid, Oid relid,
1135  LogicalRepMsgType command,
1136  TransactionId xid, const char *errmsg);
1137 extern void pgstat_report_subscription_drop(Oid subid);
1138 
1139 extern void pgstat_initialize(void);
1140 
1141 
1142 extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
1144 
1145 extern void pgstat_initstats(Relation rel);
1146 
1147 /* nontransactional event counts are simple enough to inline */
1148 
1149 #define pgstat_count_heap_scan(rel) \
1150  do { \
1151  if ((rel)->pgstat_info != NULL) \
1152  (rel)->pgstat_info->t_counts.t_numscans++; \
1153  } while (0)
1154 #define pgstat_count_heap_getnext(rel) \
1155  do { \
1156  if ((rel)->pgstat_info != NULL) \
1157  (rel)->pgstat_info->t_counts.t_tuples_returned++; \
1158  } while (0)
1159 #define pgstat_count_heap_fetch(rel) \
1160  do { \
1161  if ((rel)->pgstat_info != NULL) \
1162  (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
1163  } while (0)
1164 #define pgstat_count_index_scan(rel) \
1165  do { \
1166  if ((rel)->pgstat_info != NULL) \
1167  (rel)->pgstat_info->t_counts.t_numscans++; \
1168  } while (0)
1169 #define pgstat_count_index_tuples(rel, n) \
1170  do { \
1171  if ((rel)->pgstat_info != NULL) \
1172  (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
1173  } while (0)
1174 #define pgstat_count_buffer_read(rel) \
1175  do { \
1176  if ((rel)->pgstat_info != NULL) \
1177  (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
1178  } while (0)
1179 #define pgstat_count_buffer_hit(rel) \
1180  do { \
1181  if ((rel)->pgstat_info != NULL) \
1182  (rel)->pgstat_info->t_counts.t_blocks_hit++; \
1183  } while (0)
1184 #define pgstat_count_buffer_read_time(n) \
1185  (pgStatBlockReadTime += (n))
1186 #define pgstat_count_buffer_write_time(n) \
1187  (pgStatBlockWriteTime += (n))
1188 #define pgstat_count_conn_active_time(n) \
1189  (pgStatActiveTime += (n))
1190 #define pgstat_count_conn_txn_idle_time(n) \
1191  (pgStatTransactionIdleTime += (n))
1192 
1194 extern void pgstat_count_heap_update(Relation rel, bool hot);
1195 extern void pgstat_count_heap_delete(Relation rel);
1196 extern void pgstat_count_truncate(Relation rel);
1197 extern void pgstat_update_heap_dead_tuples(Relation rel, int delta);
1198 
1203  bool finalize);
1204 
1205 extern void AtEOXact_PgStat(bool isCommit, bool parallel);
1206 extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth);
1207 
1208 extern void AtPrepare_PgStat(void);
1209 extern void PostPrepare_PgStat(void);
1210 
1211 extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info,
1212  void *recdata, uint32 len);
1213 extern void pgstat_twophase_postabort(TransactionId xid, uint16 info,
1214  void *recdata, uint32 len);
1215 
1216 extern void pgstat_send_archiver(const char *xlog, bool failed);
1217 extern void pgstat_send_bgwriter(void);
1218 extern void pgstat_send_checkpointer(void);
1219 extern void pgstat_send_wal(bool force);
1220 
1221 /* ----------
1222  * Support functions for the SQL-callable functions to
1223  * generate the pgstat* views.
1224  * ----------
1225  */
1230  Oid subrelid);
1236 extern PgStat_SLRUStats *pgstat_fetch_slru(void);
1238 
1239 extern void pgstat_count_slru_page_zeroed(int slru_idx);
1240 extern void pgstat_count_slru_page_hit(int slru_idx);
1241 extern void pgstat_count_slru_page_read(int slru_idx);
1242 extern void pgstat_count_slru_page_written(int slru_idx);
1243 extern void pgstat_count_slru_page_exists(int slru_idx);
1244 extern void pgstat_count_slru_flush(int slru_idx);
1245 extern void pgstat_count_slru_truncate(int slru_idx);
1246 extern const char *pgstat_slru_name(int slru_idx);
1247 extern int pgstat_slru_index(const char *name);
1248 
1249 #endif /* PGSTAT_H */
unsigned short uint16
Definition: c.h:440
unsigned int uint32
Definition: c.h:441
#define PGDLLIMPORT
Definition: c.h:1318
#define pg_attribute_noreturn()
Definition: c.h:179
uint32 TransactionId
Definition: c.h:587
int64 TimestampTz
Definition: timestamp.h:39
int errmsg(const char *fmt,...)
Definition: elog.c:909
const char * name
Definition: encode.c:561
struct timeval instr_time
Definition: instr_time.h:150
LogicalRepMsgType
Definition: logicalproto.h:52
const void size_t len
#define MAX_XFN_CHARS
Definition: pgarch.h:26
NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: pgstat.c:3490
struct PgStat_MsgAnalyze PgStat_MsgAnalyze
void pgstat_reset_slru_counter(const char *)
Definition: pgstat.c:1576
struct PgStat_TableStatus PgStat_TableStatus
struct PgStat_MsgHdr PgStat_MsgHdr
#define PGSTAT_NUM_TABPURGE
Definition: pgstat.h:313
struct PgStat_FunctionEntry PgStat_FunctionEntry
SessionEndType
Definition: pgstat.h:46
@ DISCONNECT_NOT_YET
Definition: pgstat.h:47
@ DISCONNECT_FATAL
Definition: pgstat.h:50
@ DISCONNECT_KILLED
Definition: pgstat.h:51
@ DISCONNECT_CLIENT_EOF
Definition: pgstat.h:49
@ DISCONNECT_NORMAL
Definition: pgstat.h:48
PgStat_StatSubWorkerEntry * pgstat_fetch_stat_subworker_entry(Oid subid, Oid subrelid)
Definition: pgstat.c:3004
void pgstat_reset_shared_counters(const char *)
Definition: pgstat.c:1515
PgStat_Counter pgStatActiveTime
Definition: pgstat.c:246
struct PgStat_MsgChecksumFailure PgStat_MsgChecksumFailure
void pgstat_report_subscription_drop(Oid subid)
Definition: pgstat.c:1980
struct PgStat_MsgBgWriter PgStat_MsgBgWriter
struct PgStat_MsgSLRU PgStat_MsgSLRU
PgStat_MsgWal WalStats
Definition: pgstat.c:129
int pgstat_start(void)
Definition: pgstat.c:772
void pgstat_ping(void)
Definition: pgstat.c:1997
void pgstat_report_replslot_drop(const char *slotname)
Definition: pgstat.c:1934
union PgStat_Msg PgStat_Msg
struct PgStat_MsgResetsinglecounter PgStat_MsgResetsinglecounter
void AtPrepare_PgStat(void)
Definition: pgstat.c:2751
PgStat_MsgBgWriter PendingBgWriterStats
Definition: pgstat.c:127
struct PgStat_CheckpointerStats PgStat_CheckpointerStats
void pgstat_count_slru_page_exists(int slru_idx)
Definition: pgstat.c:6387
PgStat_Counter pgStatBlockReadTime
Definition: pgstat.c:243
void pgstat_count_slru_page_read(int slru_idx)
Definition: pgstat.c:6393
struct PgStat_MsgSubscriptionPurge PgStat_MsgSubscriptionPurge
void pgstat_reset_counters(void)
Definition: pgstat.c:1493
PgStat_BgWriterStats * pgstat_fetch_stat_bgwriter(void)
Definition: pgstat.c:3050
StatMsgType
Definition: pgstat.h:59
@ PGSTAT_MTYPE_DISCONNECT
Definition: pgstat.h:86
@ PGSTAT_MTYPE_AUTOVAC_START
Definition: pgstat.h:70
@ PGSTAT_MTYPE_DROPDB
Definition: pgstat.h:64
@ PGSTAT_MTYPE_SLRU
Definition: pgstat.h:77
@ PGSTAT_MTYPE_RESETSINGLECOUNTER
Definition: pgstat.h:67
@ PGSTAT_MTYPE_FUNCSTAT
Definition: pgstat.h:78
@ PGSTAT_MTYPE_CHECKPOINTER
Definition: pgstat.h:75
@ PGSTAT_MTYPE_CHECKSUMFAILURE
Definition: pgstat.h:83
@ PGSTAT_MTYPE_TABPURGE
Definition: pgstat.h:63
@ PGSTAT_MTYPE_CONNECT
Definition: pgstat.h:85
@ PGSTAT_MTYPE_DUMMY
Definition: pgstat.h:60
@ PGSTAT_MTYPE_SUBSCRIPTIONPURGE
Definition: pgstat.h:87
@ PGSTAT_MTYPE_ARCHIVER
Definition: pgstat.h:73
@ PGSTAT_MTYPE_VACUUM
Definition: pgstat.h:71
@ PGSTAT_MTYPE_INQUIRY
Definition: pgstat.h:61
@ PGSTAT_MTYPE_RECOVERYCONFLICT
Definition: pgstat.h:80
@ PGSTAT_MTYPE_WAL
Definition: pgstat.h:76
@ PGSTAT_MTYPE_FUNCPURGE
Definition: pgstat.h:79
@ PGSTAT_MTYPE_ANALYZE
Definition: pgstat.h:72
@ PGSTAT_MTYPE_RESETSHAREDCOUNTER
Definition: pgstat.h:66
@ PGSTAT_MTYPE_RESETREPLSLOTCOUNTER
Definition: pgstat.h:69
@ PGSTAT_MTYPE_RESETCOUNTER
Definition: pgstat.h:65
@ PGSTAT_MTYPE_SUBWORKERERROR
Definition: pgstat.h:88
@ PGSTAT_MTYPE_TEMPFILE
Definition: pgstat.h:81
@ PGSTAT_MTYPE_TABSTAT
Definition: pgstat.h:62
@ PGSTAT_MTYPE_BGWRITER
Definition: pgstat.h:74
@ PGSTAT_MTYPE_RESETSLRUCOUNTER
Definition: pgstat.h:68
@ PGSTAT_MTYPE_DEADLOCK
Definition: pgstat.h:82
@ PGSTAT_MTYPE_REPLSLOT
Definition: pgstat.h:84
void AtEOXact_PgStat(bool isCommit, bool parallel)
Definition: pgstat.c:2582
struct PgStat_MsgVacuum PgStat_MsgVacuum
struct PgStat_MsgDisconnect PgStat_MsgDisconnect
struct PgStat_MsgResetsharedcounter PgStat_MsgResetsharedcounter
void pgstat_count_slru_page_hit(int slru_idx)
Definition: pgstat.c:6381
#define PGSTAT_NUM_FUNCENTRIES
Definition: pgstat.h:661
void pgstat_count_heap_update(Relation rel, bool hot)
Definition: pgstat.c:2379
struct PgStat_MsgConnect PgStat_MsgConnect
void pgstat_init_function_usage(struct FunctionCallInfoBaseData *fcinfo, PgStat_FunctionCallUsage *fcu)
void pgstat_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2822
struct PgStat_MsgResetcounter PgStat_MsgResetcounter
void pgstat_send_archiver(const char *xlog, bool failed)
Definition: pgstat.c:3250
void pgstat_report_autovac(Oid dboid)
Definition: pgstat.c:1629
struct PgStat_TableCounts PgStat_TableCounts
PgStat_TableStatus * find_tabstat_entry(Oid rel_id)
Definition: pgstat.c:2289
void pgstat_report_connect(Oid dboid)
Definition: pgstat.c:1830
struct PgStat_MsgInquiry PgStat_MsgInquiry
char * pgstat_stat_directory
Definition: pgstat.c:118
void pgstat_report_replslot_create(const char *slotname)
Definition: pgstat.c:1916
void pgstat_initialize(void)
Definition: pgstat.c:3173
int pgstat_slru_index(const char *name)
Definition: pgstat.c:6318
PgStat_StatDBEntry * pgstat_fetch_stat_dbentry(Oid dbid)
Definition: pgstat.c:2892
void pgstat_report_stat(bool force)
Definition: pgstat.c:861
PgStat_Counter pgStatBlockWriteTime
Definition: pgstat.c:244
void pgstat_count_slru_page_zeroed(int slru_idx)
Definition: pgstat.c:6375
struct PgStat_GlobalStats PgStat_GlobalStats
struct PgStat_StatSubWorkerKey PgStat_StatSubWorkerKey
struct PgStat_FunctionCallUsage PgStat_FunctionCallUsage
void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
Definition: pgstat.c:1776
void pgstat_count_slru_truncate(int slru_idx)
Definition: pgstat.c:6411
void pgstat_report_checksum_failure(void)
Definition: pgstat.c:1798
PgStat_Single_Reset_Type
Definition: pgstat.h:149
@ RESET_FUNCTION
Definition: pgstat.h:151
@ RESET_TABLE
Definition: pgstat.h:150
@ RESET_SUBWORKER
Definition: pgstat.h:152
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter)
Definition: pgstat.c:1679
struct PgStat_SLRUStats PgStat_SLRUStats
struct PgStat_TableEntry PgStat_TableEntry
PgStat_StatFuncEntry * pgstat_fetch_stat_funcentry(Oid funcid)
Definition: pgstat.c:2975
#define PGSTAT_SUBWORKERERROR_MSGLEN
Definition: pgstat.h:566
struct PgStat_MsgTempFile PgStat_MsgTempFile
void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2858
void pgstat_vacuum_stat(void)
Definition: pgstat.c:1121
void allow_immediate_pgstat_restart(void)
Definition: pgstat.c:835
void pgstat_reset_replslot_counter(const char *name)
Definition: pgstat.c:1600
void pgstat_report_subworker_error(Oid subid, Oid subrelid, Oid relid, LogicalRepMsgType command, TransactionId xid, const char *errmsg)
Definition: pgstat.c:1952
void pgstat_send_checkpointer(void)
Definition: pgstat.c:3305
void pgstat_report_deadlock(void)
Definition: pgstat.c:1755
void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
Definition: pgstat.c:2105
#define PGSTAT_NUM_SUBSCRIPTIONPURGE
Definition: pgstat.h:549
void pgstat_report_recovery_conflict(int reason)
Definition: pgstat.c:1735
struct PgStat_MsgSubWorkerError PgStat_MsgSubWorkerError
struct PgStat_MsgDropdb PgStat_MsgDropdb
TrackFunctionsLevel
Definition: pgstat.h:38
@ TRACK_FUNC_PL
Definition: pgstat.h:40
@ TRACK_FUNC_ALL
Definition: pgstat.h:41
@ TRACK_FUNC_OFF
Definition: pgstat.h:39
void pgstat_count_slru_page_written(int slru_idx)
Definition: pgstat.c:6399
struct PgStat_ArchiverStats PgStat_ArchiverStats
void pgstat_send_wal(bool force)
Definition: pgstat.c:3340
PgStat_SLRUStats * pgstat_fetch_slru(void)
Definition: pgstat.c:3114
void pgstat_clear_snapshot(void)
Definition: pgstat.c:5149
void pgstat_send_bgwriter(void)
Definition: pgstat.c:3271
struct PgStat_MsgCheckpointer PgStat_MsgCheckpointer
PgStat_Shared_Reset_Target
Definition: pgstat.h:141
@ RESET_BGWRITER
Definition: pgstat.h:143
@ RESET_ARCHIVER
Definition: pgstat.h:142
@ RESET_WAL
Definition: pgstat.h:144
void PostPrepare_PgStat(void)
Definition: pgstat.c:2794
struct PgStat_FunctionCounts PgStat_FunctionCounts
struct PgStat_StatReplSlotEntry PgStat_StatReplSlotEntry
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid)
Definition: pgstat.c:2919
const char * pgstat_slru_name(int slru_idx)
Definition: pgstat.c:6340
void pgstat_init(void)
Definition: pgstat.c:395
struct PgStat_StatSubWorkerEntry PgStat_StatSubWorkerEntry
#define PGSTAT_NUM_TABENTRIES
Definition: pgstat.h:288
void pgstat_update_heap_dead_tuples(Relation rel, int delta)
Definition: pgstat.c:2491
struct PgStat_MsgReplSlot PgStat_MsgReplSlot
char * pgstat_stat_filename
Definition: pgstat.c:119
PGDLLIMPORT int pgstat_track_functions
Definition: pgstat.c:112
void pgstat_count_heap_delete(Relation rel)
Definition: pgstat.c:2404
struct PgStat_MsgTabstat PgStat_MsgTabstat
void pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
Definition: pgstat.c:2358
struct PgStat_StatDBEntry PgStat_StatDBEntry
#define PGSTAT_NUM_FUNCPURGE
Definition: pgstat.h:678
PgStat_Counter pgStatTransactionIdleTime
Definition: pgstat.c:247
void pgstat_count_slru_flush(int slru_idx)
Definition: pgstat.c:6405
PgStat_StatReplSlotEntry * pgstat_fetch_replslot(NameData slotname)
Definition: pgstat.c:3130
void AtEOSubXact_PgStat(bool isCommit, int nestDepth)
Definition: pgstat.c:2694
struct PgStat_MsgRecoveryConflict PgStat_MsgRecoveryConflict
struct PgStat_MsgResetreplslotcounter PgStat_MsgResetreplslotcounter
void pgstat_initstats(Relation rel)
Definition: pgstat.c:2162
struct PgStat_WalStats PgStat_WalStats
SessionEndType pgStatSessionEndCause
Definition: pgstat.c:248
PgStat_WalStats * pgstat_fetch_stat_wal(void)
Definition: pgstat.c:3098
void pgstat_drop_database(Oid databaseid)
Definition: pgstat.c:1438
char * pgstat_stat_tmpname
Definition: pgstat.c:120
void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples)
Definition: pgstat.c:1651
void pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
Definition: pgstat.c:1887
struct PgStat_MsgWal PgStat_MsgWal
struct PgStat_BackendFunctionEntry PgStat_BackendFunctionEntry
struct PgStat_BgWriterStats PgStat_BgWriterStats
struct PgStat_StatTabEntry PgStat_StatTabEntry
struct PgStat_MsgResetslrucounter PgStat_MsgResetslrucounter
void pgstat_count_truncate(Relation rel)
Definition: pgstat.c:2462
struct PgStat_MsgTabpurge PgStat_MsgTabpurge
PGDLLIMPORT bool pgstat_track_counts
Definition: pgstat.c:111
PgStat_MsgCheckpointer PendingCheckpointerStats
Definition: pgstat.c:128
PgStat_GlobalStats * pgstat_fetch_global(void)
Definition: pgstat.c:3082
struct PgStat_MsgDummy PgStat_MsgDummy
struct PgStat_MsgAutovacStart PgStat_MsgAutovacStart
int64 PgStat_Counter
Definition: pgstat.h:95
PgStat_CheckpointerStats * pgstat_fetch_stat_checkpointer(void)
Definition: pgstat.c:3066
PgStat_BackendFunctionEntry * find_funcstat_entry(Oid func_id)
Definition: pgstat.c:2083
struct PgStat_TableXactStatus PgStat_TableXactStatus
struct PgStat_StatFuncEntry PgStat_StatFuncEntry
struct PgStat_MsgDeadlock PgStat_MsgDeadlock
struct PgStat_MsgFuncpurge PgStat_MsgFuncpurge
void pgstat_reset_single_counter(Oid objectid, Oid subobjectid, PgStat_Single_Reset_Type type)
Definition: pgstat.c:1548
PgStat_ArchiverStats * pgstat_fetch_stat_archiver(void)
Definition: pgstat.c:3034
void pgstat_reset_all(void)
Definition: pgstat.c:730
struct PgStat_MsgArchiver PgStat_MsgArchiver
struct PgStat_MsgFuncstat PgStat_MsgFuncstat
unsigned int Oid
Definition: postgres_ext.h:31
Definition: dynahash.c:220
TimestampTz last_failed_timestamp
Definition: pgstat.h:903
TimestampTz stat_reset_timestamp
Definition: pgstat.h:904
TimestampTz last_archived_timestamp
Definition: pgstat.h:899
char last_failed_wal[MAX_XFN_CHARS+1]
Definition: pgstat.h:901
PgStat_Counter failed_count
Definition: pgstat.h:900
PgStat_Counter archived_count
Definition: pgstat.h:896
char last_archived_wal[MAX_XFN_CHARS+1]
Definition: pgstat.h:897
PgStat_FunctionCounts f_counts
Definition: pgstat.h:641
PgStat_Counter buf_written_clean
Definition: pgstat.h:912
PgStat_Counter maxwritten_clean
Definition: pgstat.h:913
PgStat_Counter buf_alloc
Definition: pgstat.h:914
TimestampTz stat_reset_timestamp
Definition: pgstat.h:915
PgStat_Counter buf_written_backend
Definition: pgstat.h:929
PgStat_Counter checkpoint_sync_time
Definition: pgstat.h:927
PgStat_Counter checkpoint_write_time
Definition: pgstat.h:926
PgStat_Counter requested_checkpoints
Definition: pgstat.h:925
PgStat_Counter timed_checkpoints
Definition: pgstat.h:924
PgStat_Counter buf_fsync_backend
Definition: pgstat.h:930
TimestampTz stats_timestamp
Definition: pgstat.h:923
PgStat_Counter buf_written_checkpoints
Definition: pgstat.h:928
instr_time save_total
Definition: pgstat.h:1036
PgStat_FunctionCounts * fs
Definition: pgstat.h:1032
instr_time save_f_total_time
Definition: pgstat.h:1034
instr_time f_total_time
Definition: pgstat.h:630
PgStat_Counter f_numcalls
Definition: pgstat.h:629
instr_time f_self_time
Definition: pgstat.h:631
PgStat_Counter f_self_time
Definition: pgstat.h:653
PgStat_Counter f_numcalls
Definition: pgstat.h:651
PgStat_Counter f_total_time
Definition: pgstat.h:652
PgStat_CheckpointerStats checkpointer
Definition: pgstat.h:940
TimestampTz stats_timestamp
Definition: pgstat.h:938
PgStat_BgWriterStats bgwriter
Definition: pgstat.h:941
PgStat_Counter m_live_tuples
Definition: pgstat.h:440
PgStat_Counter m_dead_tuples
Definition: pgstat.h:441
TimestampTz m_analyzetime
Definition: pgstat.h:439
bool m_resetcounter
Definition: pgstat.h:438
bool m_autovacuum
Definition: pgstat.h:437
PgStat_MsgHdr m_hdr
Definition: pgstat.h:434
TimestampTz m_timestamp
Definition: pgstat.h:454
PgStat_MsgHdr m_hdr
Definition: pgstat.h:451
char m_xlog[MAX_XFN_CHARS+1]
Definition: pgstat.h:453
TimestampTz m_start_time
Definition: pgstat.h:406
PgStat_MsgHdr m_hdr
Definition: pgstat.h:404
PgStat_Counter m_buf_written_clean
Definition: pgstat.h:465
PgStat_Counter m_maxwritten_clean
Definition: pgstat.h:466
PgStat_Counter m_buf_alloc
Definition: pgstat.h:467
PgStat_MsgHdr m_hdr
Definition: pgstat.h:463
PgStat_Counter m_buf_written_backend
Definition: pgstat.h:481
PgStat_Counter m_buf_fsync_backend
Definition: pgstat.h:482
PgStat_Counter m_checkpoint_write_time
Definition: pgstat.h:483
PgStat_Counter m_timed_checkpoints
Definition: pgstat.h:478
PgStat_Counter m_requested_checkpoints
Definition: pgstat.h:479
PgStat_Counter m_checkpoint_sync_time
Definition: pgstat.h:484
PgStat_Counter m_buf_written_checkpoints
Definition: pgstat.h:480
PgStat_MsgHdr m_hdr
Definition: pgstat.h:476
PgStat_MsgHdr m_hdr
Definition: pgstat.h:708
TimestampTz m_failure_time
Definition: pgstat.h:711
PgStat_MsgHdr m_hdr
Definition: pgstat.h:721
PgStat_MsgHdr m_hdr
Definition: pgstat.h:697
PgStat_MsgHdr m_hdr
Definition: pgstat.h:731
SessionEndType m_cause
Definition: pgstat.h:733
Oid m_databaseid
Definition: pgstat.h:334
PgStat_MsgHdr m_hdr
Definition: pgstat.h:333
PgStat_MsgHdr m_hdr
Definition: pgstat.h:241
Oid m_functionid[PGSTAT_NUM_FUNCPURGE]
Definition: pgstat.h:687
PgStat_MsgHdr m_hdr
Definition: pgstat.h:684
PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES]
Definition: pgstat.h:670
PgStat_MsgHdr m_hdr
Definition: pgstat.h:667
StatMsgType m_type
Definition: pgstat.h:220
int m_size
Definition: pgstat.h:221
TimestampTz clock_time
Definition: pgstat.h:267
PgStat_MsgHdr m_hdr
Definition: pgstat.h:266
TimestampTz cutoff_time
Definition: pgstat.h:268
PgStat_MsgHdr m_hdr
Definition: pgstat.h:599
PgStat_MsgHdr m_hdr
Definition: pgstat.h:530
PgStat_Counter m_spill_txns
Definition: pgstat.h:534
PgStat_Counter m_spill_bytes
Definition: pgstat.h:536
PgStat_Counter m_stream_bytes
Definition: pgstat.h:539
PgStat_Counter m_spill_count
Definition: pgstat.h:535
NameData m_slotname
Definition: pgstat.h:531
PgStat_Counter m_total_txns
Definition: pgstat.h:540
PgStat_Counter m_stream_count
Definition: pgstat.h:538
PgStat_Counter m_stream_txns
Definition: pgstat.h:537
PgStat_Counter m_total_bytes
Definition: pgstat.h:541
PgStat_MsgHdr m_hdr
Definition: pgstat.h:345
PgStat_Shared_Reset_Target m_resettarget
Definition: pgstat.h:357
PgStat_Single_Reset_Type m_resettype
Definition: pgstat.h:369
PgStat_MsgHdr m_hdr
Definition: pgstat.h:381
PgStat_Counter m_blocks_read
Definition: pgstat.h:516
PgStat_Counter m_index
Definition: pgstat.h:513
PgStat_Counter m_blocks_zeroed
Definition: pgstat.h:514
PgStat_Counter m_blocks_written
Definition: pgstat.h:517
PgStat_MsgHdr m_hdr
Definition: pgstat.h:512
PgStat_Counter m_blocks_hit
Definition: pgstat.h:515
PgStat_Counter m_flush
Definition: pgstat.h:519
PgStat_Counter m_truncate
Definition: pgstat.h:520
PgStat_Counter m_blocks_exists
Definition: pgstat.h:518
char m_message[PGSTAT_SUBWORKERERROR_MSGLEN]
Definition: pgstat.h:590
TimestampTz m_timestamp
Definition: pgstat.h:589
LogicalRepMsgType m_command
Definition: pgstat.h:587
TransactionId m_xid
Definition: pgstat.h:588
PgStat_MsgHdr m_hdr
Definition: pgstat.h:569
PgStat_MsgHdr m_hdr
Definition: pgstat.h:554
Oid m_subids[PGSTAT_NUM_SUBSCRIPTIONPURGE]
Definition: pgstat.h:557
PgStat_MsgHdr m_hdr
Definition: pgstat.h:319
Oid m_tableid[PGSTAT_NUM_TABPURGE]
Definition: pgstat.h:322
PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES]
Definition: pgstat.h:304
PgStat_Counter m_block_read_time
Definition: pgstat.h:299
PgStat_Counter m_active_time
Definition: pgstat.h:302
int m_xact_rollback
Definition: pgstat.h:298
PgStat_Counter m_idle_in_xact_time
Definition: pgstat.h:303
PgStat_Counter m_block_write_time
Definition: pgstat.h:300
PgStat_MsgHdr m_hdr
Definition: pgstat.h:294
PgStat_Counter m_session_time
Definition: pgstat.h:301
PgStat_MsgHdr m_hdr
Definition: pgstat.h:611
size_t m_filesize
Definition: pgstat.h:614
TimestampTz m_vacuumtime
Definition: pgstat.h:421
bool m_autovacuum
Definition: pgstat.h:420
PgStat_MsgHdr m_hdr
Definition: pgstat.h:417
Oid m_databaseid
Definition: pgstat.h:418
PgStat_Counter m_dead_tuples
Definition: pgstat.h:423
PgStat_Counter m_live_tuples
Definition: pgstat.h:422
PgStat_Counter m_wal_buffers_full
Definition: pgstat.h:497
PgStat_Counter m_wal_sync_time
Definition: pgstat.h:502
PgStat_Counter m_wal_sync
Definition: pgstat.h:499
PgStat_Counter m_wal_write
Definition: pgstat.h:498
PgStat_MsgHdr m_hdr
Definition: pgstat.h:493
PgStat_Counter m_wal_write_time
Definition: pgstat.h:500
PgStat_Counter m_wal_fpi
Definition: pgstat.h:495
PgStat_Counter m_wal_records
Definition: pgstat.h:494
uint64 m_wal_bytes
Definition: pgstat.h:496
PgStat_Counter blocks_read
Definition: pgstat.h:967
PgStat_Counter blocks_exists
Definition: pgstat.h:969
TimestampTz stat_reset_timestamp
Definition: pgstat.h:972
PgStat_Counter blocks_zeroed
Definition: pgstat.h:965
PgStat_Counter blocks_written
Definition: pgstat.h:968
PgStat_Counter blocks_hit
Definition: pgstat.h:966
PgStat_Counter truncate
Definition: pgstat.h:971
PgStat_Counter flush
Definition: pgstat.h:970
PgStat_Counter n_sessions_killed
Definition: pgstat.h:820
PgStat_Counter total_session_time
Definition: pgstat.h:815
TimestampTz stat_reset_timestamp
Definition: pgstat.h:822
TimestampTz last_checksum_failure
Definition: pgstat.h:811
HTAB * functions
Definition: pgstat.h:834
PgStat_Counter n_sessions_fatal
Definition: pgstat.h:819
PgStat_Counter total_idle_in_xact_time
Definition: pgstat.h:817
PgStat_Counter n_temp_bytes
Definition: pgstat.h:808
PgStat_Counter n_tuples_deleted
Definition: pgstat.h:800
PgStat_Counter n_xact_commit
Definition: pgstat.h:792
PgStat_Counter n_tuples_updated
Definition: pgstat.h:799
TimestampTz last_autovac_time
Definition: pgstat.h:801
PgStat_Counter n_xact_rollback
Definition: pgstat.h:793
PgStat_Counter n_conflict_lock
Definition: pgstat.h:803
PgStat_Counter total_active_time
Definition: pgstat.h:816
PgStat_Counter n_checksum_failures
Definition: pgstat.h:810
PgStat_Counter n_blocks_fetched
Definition: pgstat.h:794
PgStat_Counter n_deadlocks
Definition: pgstat.h:809
PgStat_Counter n_tuples_fetched
Definition: pgstat.h:797
PgStat_Counter n_block_read_time
Definition: pgstat.h:812
PgStat_Counter n_sessions
Definition: pgstat.h:814
PgStat_Counter n_conflict_tablespace
Definition: pgstat.h:802
HTAB * subworkers
Definition: pgstat.h:835
PgStat_Counter n_sessions_abandoned
Definition: pgstat.h:818
PgStat_Counter n_block_write_time
Definition: pgstat.h:813
PgStat_Counter n_conflict_bufferpin
Definition: pgstat.h:805
PgStat_Counter n_tuples_inserted
Definition: pgstat.h:798
PgStat_Counter n_tuples_returned
Definition: pgstat.h:796
PgStat_Counter n_blocks_hit
Definition: pgstat.h:795
PgStat_Counter n_conflict_startup_deadlock
Definition: pgstat.h:806
PgStat_Counter n_temp_files
Definition: pgstat.h:807
PgStat_Counter n_conflict_snapshot
Definition: pgstat.h:804
TimestampTz stats_timestamp
Definition: pgstat.h:823
PgStat_Counter f_self_time
Definition: pgstat.h:887
PgStat_Counter f_total_time
Definition: pgstat.h:886
PgStat_Counter f_numcalls
Definition: pgstat.h:884
TimestampTz stat_reset_timestamp
Definition: pgstat.h:989
PgStat_Counter stream_count
Definition: pgstat.h:985
PgStat_Counter total_txns
Definition: pgstat.h:987
PgStat_Counter total_bytes
Definition: pgstat.h:988
PgStat_Counter spill_txns
Definition: pgstat.h:981
PgStat_Counter stream_txns
Definition: pgstat.h:984
PgStat_Counter spill_count
Definition: pgstat.h:982
PgStat_Counter stream_bytes
Definition: pgstat.h:986
PgStat_Counter spill_bytes
Definition: pgstat.h:983
LogicalRepMsgType last_error_command
Definition: pgstat.h:1018
char last_error_message[PGSTAT_SUBWORKERERROR_MSGLEN]
Definition: pgstat.h:1022
TimestampTz last_error_time
Definition: pgstat.h:1021
PgStat_Counter last_error_count
Definition: pgstat.h:1020
PgStat_StatSubWorkerKey key
Definition: pgstat.h:1010
TransactionId last_error_xid
Definition: pgstat.h:1019
PgStat_Counter vacuum_count
Definition: pgstat.h:866
PgStat_Counter tuples_fetched
Definition: pgstat.h:850
TimestampTz vacuum_timestamp
Definition: pgstat.h:865
PgStat_Counter blocks_hit
Definition: pgstat.h:863
PgStat_Counter analyze_count
Definition: pgstat.h:870
TimestampTz autovac_analyze_timestamp
Definition: pgstat.h:871
PgStat_Counter tuples_deleted
Definition: pgstat.h:854
PgStat_Counter autovac_analyze_count
Definition: pgstat.h:872
PgStat_Counter tuples_hot_updated
Definition: pgstat.h:855
PgStat_Counter tuples_updated
Definition: pgstat.h:853
PgStat_Counter changes_since_analyze
Definition: pgstat.h:859
PgStat_Counter inserts_since_vacuum
Definition: pgstat.h:860
PgStat_Counter autovac_vacuum_count
Definition: pgstat.h:868
PgStat_Counter numscans
Definition: pgstat.h:847
PgStat_Counter blocks_fetched
Definition: pgstat.h:862
PgStat_Counter tuples_returned
Definition: pgstat.h:849
TimestampTz analyze_timestamp
Definition: pgstat.h:869
PgStat_Counter n_live_tuples
Definition: pgstat.h:857
TimestampTz autovac_vacuum_timestamp
Definition: pgstat.h:867
PgStat_Counter n_dead_tuples
Definition: pgstat.h:858
PgStat_Counter tuples_inserted
Definition: pgstat.h:852
PgStat_Counter t_delta_dead_tuples
Definition: pgstat.h:132
PgStat_Counter t_delta_live_tuples
Definition: pgstat.h:131
PgStat_Counter t_tuples_hot_updated
Definition: pgstat.h:128
PgStat_Counter t_tuples_inserted
Definition: pgstat.h:125
PgStat_Counter t_tuples_updated
Definition: pgstat.h:126
PgStat_Counter t_tuples_fetched
Definition: pgstat.h:123
PgStat_Counter t_tuples_deleted
Definition: pgstat.h:127
PgStat_Counter t_numscans
Definition: pgstat.h:120
PgStat_Counter t_blocks_hit
Definition: pgstat.h:136
bool t_truncdropped
Definition: pgstat.h:129
PgStat_Counter t_changed_tuples
Definition: pgstat.h:133
PgStat_Counter t_blocks_fetched
Definition: pgstat.h:135
PgStat_Counter t_tuples_returned
Definition: pgstat.h:122
PgStat_TableCounts t_counts
Definition: pgstat.h:280
PgStat_TableCounts t_counts
Definition: pgstat.h:181
struct PgStat_TableXactStatus * trans
Definition: pgstat.h:180
struct PgStat_TableXactStatus * next
Definition: pgstat.h:204
PgStat_Counter deleted_pre_truncdrop
Definition: pgstat.h:198
PgStat_TableStatus * parent
Definition: pgstat.h:202
PgStat_Counter tuples_inserted
Definition: pgstat.h:190
PgStat_Counter tuples_updated
Definition: pgstat.h:191
PgStat_Counter inserted_pre_truncdrop
Definition: pgstat.h:196
PgStat_Counter tuples_deleted
Definition: pgstat.h:192
struct PgStat_TableXactStatus * upper
Definition: pgstat.h:201
PgStat_Counter updated_pre_truncdrop
Definition: pgstat.h:197
PgStat_Counter wal_write
Definition: pgstat.h:953
PgStat_Counter wal_buffers_full
Definition: pgstat.h:952
PgStat_Counter wal_write_time
Definition: pgstat.h:955
TimestampTz stat_reset_timestamp
Definition: pgstat.h:957
uint64 wal_bytes
Definition: pgstat.h:951
PgStat_Counter wal_sync_time
Definition: pgstat.h:956
PgStat_Counter wal_fpi
Definition: pgstat.h:950
PgStat_Counter wal_sync
Definition: pgstat.h:954
PgStat_Counter wal_records
Definition: pgstat.h:949
Definition: c.h:676
PgStat_MsgInquiry msg_inquiry
Definition: pgstat.h:744
PgStat_MsgReplSlot msg_replslot
Definition: pgstat.h:767
PgStat_MsgArchiver msg_archiver
Definition: pgstat.h:756
PgStat_MsgDropdb msg_dropdb
Definition: pgstat.h:747
PgStat_MsgConnect msg_connect
Definition: pgstat.h:768
PgStat_MsgSubWorkerError msg_subworkererror
Definition: pgstat.h:771
PgStat_MsgWal msg_wal
Definition: pgstat.h:759
PgStat_MsgDisconnect msg_disconnect
Definition: pgstat.h:769
PgStat_MsgAutovacStart msg_autovacuum_start
Definition: pgstat.h:753
PgStat_MsgSubscriptionPurge msg_subscriptionpurge
Definition: pgstat.h:770
PgStat_MsgTempFile msg_tempfile
Definition: pgstat.h:765
PgStat_MsgResetreplslotcounter msg_resetreplslotcounter
Definition: pgstat.h:752
PgStat_MsgBgWriter msg_bgwriter
Definition: pgstat.h:757
PgStat_MsgResetsinglecounter msg_resetsinglecounter
Definition: pgstat.h:750
PgStat_MsgResetcounter msg_resetcounter
Definition: pgstat.h:748
PgStat_MsgDummy msg_dummy
Definition: pgstat.h:743
PgStat_MsgFuncstat msg_funcstat
Definition: pgstat.h:761
PgStat_MsgRecoveryConflict msg_recoveryconflict
Definition: pgstat.h:763
PgStat_MsgResetsharedcounter msg_resetsharedcounter
Definition: pgstat.h:749
PgStat_MsgFuncpurge msg_funcpurge
Definition: pgstat.h:762
PgStat_MsgResetslrucounter msg_resetslrucounter
Definition: pgstat.h:751
PgStat_MsgDeadlock msg_deadlock
Definition: pgstat.h:764
PgStat_MsgSLRU msg_slru
Definition: pgstat.h:760
PgStat_MsgChecksumFailure msg_checksumfailure
Definition: pgstat.h:766
PgStat_MsgTabpurge msg_tabpurge
Definition: pgstat.h:746
PgStat_MsgHdr msg_hdr
Definition: pgstat.h:742
PgStat_MsgAnalyze msg_analyze
Definition: pgstat.h:755
PgStat_MsgVacuum msg_vacuum
Definition: pgstat.h:754
PgStat_MsgCheckpointer msg_checkpointer
Definition: pgstat.h:758
PgStat_MsgTabstat msg_tabstat
Definition: pgstat.h:745