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 */
17 #include "utils/backend_progress.h" /* for backward compatibility */
18 #include "utils/backend_status.h" /* for backward compatibility */
19 #include "utils/hsearch.h"
20 #include "utils/relcache.h"
21 #include "utils/wait_event.h" /* for backward compatibility */
22 
23 
24 /* ----------
25  * Paths for the statistics files (relative to installation's $PGDATA).
26  * ----------
27  */
28 #define PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat"
29 #define PGSTAT_STAT_PERMANENT_FILENAME "pg_stat/global.stat"
30 #define PGSTAT_STAT_PERMANENT_TMPFILE "pg_stat/global.tmp"
31 
32 /* Default directory to store temporary statistics data in */
33 #define PG_STAT_TMP_DIR "pg_stat_tmp"
34 
35 /* Values for track_functions GUC variable --- order is significant! */
36 typedef enum TrackFunctionsLevel
37 {
42 
43 /* Values to track the cause of session termination */
44 typedef enum SessionEndType
45 {
46  DISCONNECT_NOT_YET, /* still active */
52 
53 /* ----------
54  * The types of backend -> collector messages
55  * ----------
56  */
57 typedef enum StatMsgType
58 {
86 } StatMsgType;
87 
88 /* ----------
89  * The data type used for counters.
90  * ----------
91  */
92 typedef int64 PgStat_Counter;
93 
94 /* ----------
95  * PgStat_TableCounts The actual per-table counts kept by a backend
96  *
97  * This struct should contain only actual event counters, because we memcmp
98  * it against zeroes to detect whether there are any counts to transmit.
99  * It is a component of PgStat_TableStatus (within-backend state) and
100  * PgStat_TableEntry (the transmitted message format).
101  *
102  * Note: for a table, tuples_returned is the number of tuples successfully
103  * fetched by heap_getnext, while tuples_fetched is the number of tuples
104  * successfully fetched by heap_fetch under the control of bitmap indexscans.
105  * For an index, tuples_returned is the number of index entries returned by
106  * the index AM, while tuples_fetched is the number of tuples successfully
107  * fetched by heap_fetch under the control of simple indexscans for this index.
108  *
109  * tuples_inserted/updated/deleted/hot_updated count attempted actions,
110  * regardless of whether the transaction committed. delta_live_tuples,
111  * delta_dead_tuples, changed_tuples are set depending on commit or abort.
112  * Note that delta_live_tuples and delta_dead_tuples can be negative!
113  * ----------
114  */
115 typedef struct PgStat_TableCounts
116 {
118 
121 
127 
131 
135 
136 /* Possible targets for resetting cluster-wide shared values */
138 {
143 
144 /* Possible object types for resetting single counters */
146 {
150 
151 /* ------------------------------------------------------------
152  * Structures kept in backend local memory while accumulating counts
153  * ------------------------------------------------------------
154  */
155 
156 
157 /* ----------
158  * PgStat_TableStatus Per-table status within a backend
159  *
160  * Many of the event counters are nontransactional, ie, we count events
161  * in committed and aborted transactions alike. For these, we just count
162  * directly in the PgStat_TableStatus. However, delta_live_tuples,
163  * delta_dead_tuples, and changed_tuples must be derived from event counts
164  * with awareness of whether the transaction or subtransaction committed or
165  * aborted. Hence, we also keep a stack of per-(sub)transaction status
166  * records for every table modified in the current transaction. At commit
167  * or abort, we propagate tuples_inserted/updated/deleted up to the
168  * parent subtransaction level, or out to the parent PgStat_TableStatus,
169  * as appropriate.
170  * ----------
171  */
172 typedef struct PgStat_TableStatus
173 {
174  Oid t_id; /* table's OID */
175  bool t_shared; /* is it a shared catalog? */
176  struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */
177  PgStat_TableCounts t_counts; /* event counts to be sent */
179 
180 /* ----------
181  * PgStat_TableXactStatus Per-table, per-subtransaction status
182  * ----------
183  */
185 {
186  PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
187  PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
188  PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
189  bool truncated; /* relation truncated in this (sub)xact */
190  PgStat_Counter inserted_pre_trunc; /* tuples inserted prior to truncate */
191  PgStat_Counter updated_pre_trunc; /* tuples updated prior to truncate */
192  PgStat_Counter deleted_pre_trunc; /* tuples deleted prior to truncate */
193  int nest_level; /* subtransaction nest level */
194  /* links to other structs for same relation: */
195  struct PgStat_TableXactStatus *upper; /* next higher subxact if any */
196  PgStat_TableStatus *parent; /* per-table status */
197  /* structs of same subxact level are linked here: */
198  struct PgStat_TableXactStatus *next; /* next of same subxact */
200 
201 /*
202  * Recovery prefetching statistics persisted on disk by pgstat.c, but kept in
203  * shared memory by xlogprefetch.c.
204  */
206 {
214 
215 /* ------------------------------------------------------------
216  * Message formats follow
217  * ------------------------------------------------------------
218  */
219 
220 
221 /* ----------
222  * PgStat_MsgHdr The common message header
223  * ----------
224  */
225 typedef struct PgStat_MsgHdr
226 {
228  int m_size;
229 } PgStat_MsgHdr;
230 
231 /* ----------
232  * Space available in a message. This will keep the UDP packets below 1K,
233  * which should fit unfragmented into the MTU of the loopback interface.
234  * (Larger values of PGSTAT_MAX_MSG_SIZE would work for that on most
235  * platforms, but we're being conservative here.)
236  * ----------
237  */
238 #define PGSTAT_MAX_MSG_SIZE 1000
239 #define PGSTAT_MSG_PAYLOAD (PGSTAT_MAX_MSG_SIZE - sizeof(PgStat_MsgHdr))
240 
241 
242 /* ----------
243  * PgStat_MsgDummy A dummy message, ignored by the collector
244  * ----------
245  */
246 typedef struct PgStat_MsgDummy
247 {
250 
251 
252 /* ----------
253  * PgStat_MsgInquiry Sent by a backend to ask the collector
254  * to write the stats file(s).
255  *
256  * Ordinarily, an inquiry message prompts writing of the global stats file,
257  * the stats file for shared catalogs, and the stats file for the specified
258  * database. If databaseid is InvalidOid, only the first two are written.
259  *
260  * New file(s) will be written only if the existing file has a timestamp
261  * older than the specified cutoff_time; this prevents duplicated effort
262  * when multiple requests arrive at nearly the same time, assuming that
263  * backends send requests with cutoff_times a little bit in the past.
264  *
265  * clock_time should be the requestor's current local time; the collector
266  * uses this to check for the system clock going backward, but it has no
267  * effect unless that occurs. We assume clock_time >= cutoff_time, though.
268  * ----------
269  */
270 
271 typedef struct PgStat_MsgInquiry
272 {
274  TimestampTz clock_time; /* observed local clock time */
275  TimestampTz cutoff_time; /* minimum acceptable file timestamp */
276  Oid databaseid; /* requested DB (InvalidOid => shared only) */
278 
279 
280 /* ----------
281  * PgStat_TableEntry Per-table info in a MsgTabstat
282  * ----------
283  */
284 typedef struct PgStat_TableEntry
285 {
289 
290 /* ----------
291  * PgStat_MsgTabstat Sent by the backend to report table
292  * and buffer access statistics.
293  * ----------
294  */
295 #define PGSTAT_NUM_TABENTRIES \
296  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int) - 2 * sizeof(PgStat_Counter)) \
297  / sizeof(PgStat_TableEntry))
298 
299 typedef struct PgStat_MsgTabstat
300 {
306  PgStat_Counter m_block_read_time; /* times in microseconds */
310 
311 
312 /* ----------
313  * PgStat_MsgTabpurge Sent by the backend to tell the collector
314  * about dead tables.
315  * ----------
316  */
317 #define PGSTAT_NUM_TABPURGE \
318  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
319  / sizeof(Oid))
320 
321 typedef struct PgStat_MsgTabpurge
322 {
328 
329 
330 /* ----------
331  * PgStat_MsgDropdb Sent by the backend to tell the collector
332  * about a dropped database
333  * ----------
334  */
335 typedef struct PgStat_MsgDropdb
336 {
340 
341 
342 /* ----------
343  * PgStat_MsgResetcounter Sent by the backend to tell the collector
344  * to reset counters
345  * ----------
346  */
348 {
352 
353 /* ----------
354  * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector
355  * to reset a shared counter
356  * ----------
357  */
359 {
363 
364 /* ----------
365  * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector
366  * to reset a single counter
367  * ----------
368  */
370 {
376 
377 /* ----------
378  * PgStat_MsgResetslrucounter Sent by the backend to tell the collector
379  * to reset a SLRU counter
380  * ----------
381  */
383 {
385  int m_index;
387 
388 /* ----------
389  * PgStat_MsgResetreplslotcounter Sent by the backend to tell the collector
390  * to reset replication slot counter(s)
391  * ----------
392  */
394 {
397  bool clearall;
399 
400 /* ----------
401  * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal
402  * that a database is going to be processed
403  * ----------
404  */
406 {
411 
412 
413 /* ----------
414  * PgStat_MsgVacuum Sent by the backend or autovacuum daemon
415  * after VACUUM
416  * ----------
417  */
418 typedef struct PgStat_MsgVacuum
419 {
428 
429 
430 /* ----------
431  * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon
432  * after ANALYZE
433  * ----------
434  */
435 typedef struct PgStat_MsgAnalyze
436 {
446 
447 /* ----------
448  * PgStat_MsgAnlAncestors Sent by the backend or autovacuum daemon
449  * to inform partitioned tables that are
450  * ancestors of a partition, to propagate
451  * analyze counters
452  * ----------
453  */
454 #define PGSTAT_NUM_ANCESTORENTRIES \
455  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(Oid) - sizeof(int)) \
456  / sizeof(Oid))
457 
459 {
466 
467 /* ----------
468  * PgStat_MsgArchiver Sent by the archiver to update statistics.
469  * ----------
470  */
471 typedef struct PgStat_MsgArchiver
472 {
474  bool m_failed; /* Failed attempt */
475  char m_xlog[MAX_XFN_CHARS + 1];
478 
479 /* ----------
480  * PgStat_MsgBgWriter Sent by the bgwriter to update statistics.
481  * ----------
482  */
483 typedef struct PgStat_MsgBgWriter
484 {
486 
495  PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */
498 
499 /* ----------
500  * PgStat_MsgWal Sent by backends and background processes to update WAL statistics.
501  * ----------
502  */
503 typedef struct PgStat_MsgWal
504 {
508  uint64 m_wal_bytes;
512  PgStat_Counter m_wal_write_time; /* time spent writing wal records in
513  * microseconds */
514  PgStat_Counter m_wal_sync_time; /* time spent syncing wal records in
515  * microseconds */
516 } PgStat_MsgWal;
517 
518 /* ----------
519  * PgStat_MsgSLRU Sent by a backend to update SLRU statistics.
520  * ----------
521  */
522 typedef struct PgStat_MsgSLRU
523 {
534 
535 /* ----------
536  * PgStat_MsgReplSlot Sent by a backend or a wal sender to update replication
537  * slot statistics.
538  * ----------
539  */
540 typedef struct PgStat_MsgReplSlot
541 {
544  bool m_drop;
554 
555 /* ----------
556  * PgStat_MsgRecoveryPrefetch Sent by XLogPrefetch to save statistics.
557  * ----------
558  */
560 {
564 
565 /* ----------
566  * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict
567  * ----------
568  */
570 {
572 
574  int m_reason;
576 
577 /* ----------
578  * PgStat_MsgTempFile Sent by the backend upon creating a temp file
579  * ----------
580  */
581 typedef struct PgStat_MsgTempFile
582 {
584 
586  size_t m_filesize;
588 
589 /* ----------
590  * PgStat_FunctionCounts The actual per-function counts kept by a backend
591  *
592  * This struct should contain only actual event counters, because we memcmp
593  * it against zeroes to detect whether there are any counts to transmit.
594  *
595  * Note that the time counters are in instr_time format here. We convert to
596  * microseconds in PgStat_Counter format when transmitting to the collector.
597  * ----------
598  */
599 typedef struct PgStat_FunctionCounts
600 {
605 
606 /* ----------
607  * PgStat_BackendFunctionEntry Entry in backend's per-function hash table
608  * ----------
609  */
611 {
615 
616 /* ----------
617  * PgStat_FunctionEntry Per-function info in a MsgFuncstat
618  * ----------
619  */
620 typedef struct PgStat_FunctionEntry
621 {
624  PgStat_Counter f_total_time; /* times in microseconds */
627 
628 /* ----------
629  * PgStat_MsgFuncstat Sent by the backend to report function
630  * usage statistics.
631  * ----------
632  */
633 #define PGSTAT_NUM_FUNCENTRIES \
634  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
635  / sizeof(PgStat_FunctionEntry))
636 
637 typedef struct PgStat_MsgFuncstat
638 {
644 
645 /* ----------
646  * PgStat_MsgFuncpurge Sent by the backend to tell the collector
647  * about dead functions.
648  * ----------
649  */
650 #define PGSTAT_NUM_FUNCPURGE \
651  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
652  / sizeof(Oid))
653 
654 typedef struct PgStat_MsgFuncpurge
655 {
659  Oid m_functionid[PGSTAT_NUM_FUNCPURGE];
661 
662 /* ----------
663  * PgStat_MsgDeadlock Sent by the backend to tell the collector
664  * about a deadlock that occurred.
665  * ----------
666  */
667 typedef struct PgStat_MsgDeadlock
668 {
672 
673 /* ----------
674  * PgStat_MsgChecksumFailure Sent by the backend to tell the collector
675  * about checksum failures noticed.
676  * ----------
677  */
679 {
685 
686 /* ----------
687  * PgStat_MsgConn Sent by the backend to update connection statistics.
688  * ----------
689  */
690 typedef struct PgStat_MsgConn
691 {
700 
701 
702 /* ----------
703  * PgStat_Msg Union over all possible messages.
704  * ----------
705  */
706 typedef union PgStat_Msg
707 {
736 } PgStat_Msg;
737 
738 
739 /* ------------------------------------------------------------
740  * Statistic collector data structures follow
741  *
742  * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these
743  * data structures change.
744  * ------------------------------------------------------------
745  */
746 
747 #define PGSTAT_FILE_FORMAT_ID 0x01A5BCA2
748 
749 /* ----------
750  * PgStat_StatDBEntry The collector's data per database
751  * ----------
752  */
753 typedef struct PgStat_StatDBEntry
754 {
776  PgStat_Counter n_block_read_time; /* times in microseconds */
785 
787  TimestampTz stats_timestamp; /* time of db stats file update */
788 
789  /*
790  * tables and functions must be last in the struct, because we don't write
791  * the pointers out to the stats file.
792  */
796 
797 
798 /* ----------
799  * PgStat_StatTabEntry The collector's data per table (or index)
800  * ----------
801  */
802 typedef struct PgStat_StatTabEntry
803 {
805 
807 
810 
815 
821 
824 
825  TimestampTz vacuum_timestamp; /* user initiated vacuum */
827  TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */
829  TimestampTz analyze_timestamp; /* user initiated */
831  TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */
834 
835 
836 /* ----------
837  * PgStat_StatFuncEntry The collector's data per function
838  * ----------
839  */
840 typedef struct PgStat_StatFuncEntry
841 {
843 
845 
846  PgStat_Counter f_total_time; /* times in microseconds */
849 
850 
851 /*
852  * Archiver statistics kept in the stats collector
853  */
854 typedef struct PgStat_ArchiverStats
855 {
856  PgStat_Counter archived_count; /* archival successes */
857  char last_archived_wal[MAX_XFN_CHARS + 1]; /* last WAL file
858  * archived */
859  TimestampTz last_archived_timestamp; /* last archival success time */
860  PgStat_Counter failed_count; /* failed archival attempts */
861  char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in
862  * last failure */
863  TimestampTz last_failed_timestamp; /* last archival failure time */
866 
867 /*
868  * Global statistics kept in the stats collector
869  */
870 typedef struct PgStat_GlobalStats
871 {
872  TimestampTz stats_timestamp; /* time of stats file update */
875  PgStat_Counter checkpoint_write_time; /* times in milliseconds */
885 
886 /*
887  * WAL statistics kept in the stats collector
888  */
889 typedef struct PgStat_WalStats
890 {
893  uint64 wal_bytes;
901 
902 /*
903  * SLRU statistics kept in the stats collector
904  */
905 typedef struct PgStat_SLRUStats
906 {
916 
917 /*
918  * Replication slot statistics kept in the stats collector
919  */
920 typedef struct PgStat_ReplSlotStats
921 {
933 
934 
935 /*
936  * Working state needed to accumulate per-function-call timing statistics.
937  */
939 {
940  /* Link to function's hashtable entry (must still be there at exit!) */
941  /* NULL means we are not tracking the current function call */
943  /* Total time previously charged to function, as of function start */
945  /* Backend-wide total time as of function start */
947  /* system clock as of function start */
950 
951 
952 /* ----------
953  * GUC parameters
954  * ----------
955  */
956 extern PGDLLIMPORT bool pgstat_track_counts;
958 extern char *pgstat_stat_directory;
959 extern char *pgstat_stat_tmpname;
960 extern char *pgstat_stat_filename;
961 
962 /*
963  * BgWriter statistics counters are updated directly by bgwriter and bufmgr
964  */
966 
967 /*
968  * WAL statistics counter is updated by backends and background processes
969  */
970 extern PgStat_MsgWal WalStats;
971 
972 /*
973  * Updated by pgstat_count_buffer_*_time macros
974  */
977 
978 /*
979  * Updated by pgstat_count_conn_*_time macros, called by
980  * pgstat_report_activity().
981  */
984 
985 
986 /*
987  * Updated by the traffic cop and in errfinish()
988  */
990 
991 /* ----------
992  * Functions called from postmaster
993  * ----------
994  */
995 extern void pgstat_init(void);
996 extern int pgstat_start(void);
997 extern void pgstat_reset_all(void);
998 extern void allow_immediate_pgstat_restart(void);
999 
1000 #ifdef EXEC_BACKEND
1001 extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn();
1002 #endif
1003 
1004 
1005 /* ----------
1006  * Functions called from backends
1007  * ----------
1008  */
1009 extern void pgstat_ping(void);
1010 
1011 extern void pgstat_report_stat(bool force);
1012 extern void pgstat_vacuum_stat(void);
1013 extern void pgstat_drop_database(Oid databaseid);
1014 
1015 extern void pgstat_clear_snapshot(void);
1016 extern void pgstat_reset_counters(void);
1017 extern void pgstat_reset_shared_counters(const char *);
1019 extern void pgstat_reset_slru_counter(const char *);
1020 extern void pgstat_reset_replslot_counter(const char *name);
1021 
1022 extern void pgstat_report_autovac(Oid dboid);
1023 extern void pgstat_report_vacuum(Oid tableoid, bool shared,
1024  PgStat_Counter livetuples, PgStat_Counter deadtuples);
1025 extern void pgstat_report_analyze(Relation rel,
1026  PgStat_Counter livetuples, PgStat_Counter deadtuples,
1027  bool resetcounter);
1028 extern void pgstat_report_anl_ancestors(Oid relid);
1029 
1030 extern void pgstat_report_recovery_conflict(int reason);
1031 extern void pgstat_report_deadlock(void);
1032 extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount);
1033 extern void pgstat_report_checksum_failure(void);
1034 extern void pgstat_report_replslot(const PgStat_ReplSlotStats *repSlotStat);
1035 extern void pgstat_report_replslot_drop(const char *slotname);
1036 
1037 extern void pgstat_initialize(void);
1038 
1039 
1040 extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
1042 
1043 extern void pgstat_initstats(Relation rel);
1044 
1045 /* nontransactional event counts are simple enough to inline */
1046 
1047 #define pgstat_count_heap_scan(rel) \
1048  do { \
1049  if ((rel)->pgstat_info != NULL) \
1050  (rel)->pgstat_info->t_counts.t_numscans++; \
1051  } while (0)
1052 #define pgstat_count_heap_getnext(rel) \
1053  do { \
1054  if ((rel)->pgstat_info != NULL) \
1055  (rel)->pgstat_info->t_counts.t_tuples_returned++; \
1056  } while (0)
1057 #define pgstat_count_heap_fetch(rel) \
1058  do { \
1059  if ((rel)->pgstat_info != NULL) \
1060  (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
1061  } while (0)
1062 #define pgstat_count_index_scan(rel) \
1063  do { \
1064  if ((rel)->pgstat_info != NULL) \
1065  (rel)->pgstat_info->t_counts.t_numscans++; \
1066  } while (0)
1067 #define pgstat_count_index_tuples(rel, n) \
1068  do { \
1069  if ((rel)->pgstat_info != NULL) \
1070  (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
1071  } while (0)
1072 #define pgstat_count_buffer_read(rel) \
1073  do { \
1074  if ((rel)->pgstat_info != NULL) \
1075  (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
1076  } while (0)
1077 #define pgstat_count_buffer_hit(rel) \
1078  do { \
1079  if ((rel)->pgstat_info != NULL) \
1080  (rel)->pgstat_info->t_counts.t_blocks_hit++; \
1081  } while (0)
1082 #define pgstat_count_buffer_read_time(n) \
1083  (pgStatBlockReadTime += (n))
1084 #define pgstat_count_buffer_write_time(n) \
1085  (pgStatBlockWriteTime += (n))
1086 #define pgstat_count_conn_active_time(n) \
1087  (pgStatActiveTime += (n))
1088 #define pgstat_count_conn_txn_idle_time(n) \
1089  (pgStatTransactionIdleTime += (n))
1090 
1092 extern void pgstat_count_heap_update(Relation rel, bool hot);
1093 extern void pgstat_count_heap_delete(Relation rel);
1094 extern void pgstat_count_truncate(Relation rel);
1095 extern void pgstat_update_heap_dead_tuples(Relation rel, int delta);
1096 
1098 extern void pgstat_init_function_usage(struct FunctionCallInfoBaseData *fcinfo,
1101  bool finalize);
1102 
1103 extern void AtEOXact_PgStat(bool isCommit, bool parallel);
1104 extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth);
1105 
1106 extern void AtPrepare_PgStat(void);
1107 extern void PostPrepare_PgStat(void);
1108 
1109 extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info,
1110  void *recdata, uint32 len);
1111 extern void pgstat_twophase_postabort(TransactionId xid, uint16 info,
1112  void *recdata, uint32 len);
1113 
1114 extern void pgstat_send_archiver(const char *xlog, bool failed);
1115 extern void pgstat_send_bgwriter(void);
1117 extern void pgstat_report_wal(void);
1118 extern bool pgstat_send_wal(bool force);
1119 
1120 /* ----------
1121  * Support functions for the SQL-callable functions to
1122  * generate the pgstat* views.
1123  * ----------
1124  */
1131 extern PgStat_SLRUStats *pgstat_fetch_slru(void);
1132 extern PgStat_ReplSlotStats *pgstat_fetch_replslot(int *nslots_p);
1134 
1135 extern void pgstat_count_slru_page_zeroed(int slru_idx);
1136 extern void pgstat_count_slru_page_hit(int slru_idx);
1137 extern void pgstat_count_slru_page_read(int slru_idx);
1138 extern void pgstat_count_slru_page_written(int slru_idx);
1139 extern void pgstat_count_slru_page_exists(int slru_idx);
1140 extern void pgstat_count_slru_flush(int slru_idx);
1141 extern void pgstat_count_slru_truncate(int slru_idx);
1142 extern const char *pgstat_slru_name(int slru_idx);
1143 extern int pgstat_slru_index(const char *name);
1144 
1145 #endif /* PGSTAT_H */
void pgstat_report_checksum_failure(void)
Definition: pgstat.c:1784
void pgstat_count_truncate(Relation rel)
Definition: pgstat.c:2318
PgStat_MsgResetslrucounter msg_resetslrucounter
Definition: pgstat.h:717
PgStat_MsgAutovacStart msg_autovacuum_start
Definition: pgstat.h:719
PgStat_MsgBgWriter msg_bgwriter
Definition: pgstat.h:724
PgStat_Counter m_buf_fsync_backend
Definition: pgstat.h:493
PgStat_ArchiverStats * pgstat_fetch_stat_archiver(void)
Definition: pgstat.c:2814
void pgstat_initialize(void)
Definition: pgstat.c:2934
PgStat_MsgHdr m_hdr
Definition: pgstat.h:561
PgStat_Counter analyze_count
Definition: pgstat.h:830
instr_time f_self_time
Definition: pgstat.h:603
int pgstat_start(void)
Definition: pgstat.c:757
#define pg_attribute_noreturn()
Definition: c.h:179
PgStat_Counter buf_alloc
Definition: pgstat.h:882
instr_time f_start
Definition: pgstat.h:948
PgStat_Counter archived_count
Definition: pgstat.h:856
PgStat_MsgHdr m_hdr
Definition: pgstat.h:505
void pgstat_ping(void)
Definition: pgstat.c:1861
PgStat_Counter m_buf_written_checkpoints
Definition: pgstat.h:489
PgStat_Counter m_buf_alloc
Definition: pgstat.h:494
struct PgStat_MsgFuncpurge PgStat_MsgFuncpurge
PgStat_Counter t_delta_live_tuples
Definition: pgstat.h:128
PgStat_Counter m_dead_tuples
Definition: pgstat.h:426
void pgstat_clear_snapshot(void)
Definition: pgstat.c:4758
PgStat_Counter stream_count
Definition: pgstat.h:927
PgStat_Counter wal_records
Definition: pgstat.h:891
int64 PgStat_Counter
Definition: pgstat.h:92
PgStat_Counter wal_write
Definition: pgstat.h:895
PgStat_Counter total_txns
Definition: pgstat.h:929
PgStat_Counter m_checkpoint_write_time
Definition: pgstat.h:495
TimestampTz m_vacuumtime
Definition: pgstat.h:424
PgStat_Counter tuples_updated
Definition: pgstat.h:187
TimestampTz stat_reset_timestamp
Definition: pgstat.h:899
NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: pgstat.c:3206
PgStat_Counter m_flush
Definition: pgstat.h:531
struct PgStat_MsgResetreplslotcounter PgStat_MsgResetreplslotcounter
PgStat_Counter tuples_returned
Definition: pgstat.h:808
PgStat_MsgDeadlock msg_deadlock
Definition: pgstat.h:731
void pgstat_count_slru_page_exists(int slru_idx)
Definition: pgstat.c:5882
uint32 TransactionId
Definition: c.h:587
PgStat_MsgResetsharedcounter msg_resetsharedcounter
Definition: pgstat.h:715
union PgStat_Msg PgStat_Msg
TimestampTz stats_timestamp
Definition: pgstat.h:787
PgStat_MsgHdr m_hdr
Definition: pgstat.h:692
TrackFunctionsLevel
Definition: pgstat.h:36
PgStat_Counter t_tuples_fetched
Definition: pgstat.h:120
PgStat_MsgHdr m_hdr
Definition: pgstat.h:583
PgStat_MsgChecksumFailure msg_checksumfailure
Definition: pgstat.h:733
PgStat_Counter m_live_tuples
Definition: pgstat.h:425
void pgstat_count_slru_page_written(int slru_idx)
Definition: pgstat.c:5894
PgStat_MsgRecoveryPrefetch msg_recoveryprefetch
Definition: pgstat.h:727
TimestampTz clock_time
Definition: pgstat.h:274
instr_time save_total
Definition: pgstat.h:946
PgStat_Counter n_blocks_hit
Definition: pgstat.h:759
int64 TimestampTz
Definition: timestamp.h:39
#define PGSTAT_NUM_TABPURGE
Definition: pgstat.h:317
struct PgStat_MsgTabpurge PgStat_MsgTabpurge
void pgstat_update_heap_dead_tuples(Relation rel, int delta)
Definition: pgstat.c:2347
PgStat_MsgHdr m_hdr
Definition: pgstat.h:407
struct PgStat_MsgArchiver PgStat_MsgArchiver
PgStat_Counter m_timed_checkpoints
Definition: pgstat.h:487
PgStat_Counter n_conflict_bufferpin
Definition: pgstat.h:769
PgStat_Counter m_maxwritten_clean
Definition: pgstat.h:491
PgStat_Counter n_conflict_startup_deadlock
Definition: pgstat.h:770
PgStat_Counter t_tuples_hot_updated
Definition: pgstat.h:125
PgStat_MsgHdr m_hdr
Definition: pgstat.h:485
TimestampTz autovac_analyze_timestamp
Definition: pgstat.h:831
PgStat_Counter wal_sync_time
Definition: pgstat.h:898
struct PgStat_MsgDeadlock PgStat_MsgDeadlock
struct timeval instr_time
Definition: instr_time.h:150
PgStat_Counter f_self_time
Definition: pgstat.h:625
PgStat_Counter timed_checkpoints
Definition: pgstat.h:873
TimestampTz stat_reset_timestamp
Definition: pgstat.h:914
PgStat_MsgHdr m_hdr
Definition: pgstat.h:656
PgStat_Counter n_checksum_failures
Definition: pgstat.h:774
struct PgStat_RecoveryPrefetchStats PgStat_RecoveryPrefetchStats
TimestampTz stat_reset_timestamp
Definition: pgstat.h:931
PgStat_Counter n_temp_files
Definition: pgstat.h:771
PgStat_MsgHdr m_hdr
Definition: pgstat.h:680
Oid m_databaseid
Definition: pgstat.h:421
PgStat_Counter m_buf_written_clean
Definition: pgstat.h:490
PgStat_MsgDummy msg_dummy
Definition: pgstat.h:709
TimestampTz last_checksum_failure
Definition: pgstat.h:775
PgStat_Counter m_wal_sync
Definition: pgstat.h:511
uint64 m_wal_bytes
Definition: pgstat.h:508
PgStat_Counter m_spill_bytes
Definition: pgstat.h:547
HTAB * functions
Definition: pgstat.h:794
PgStat_Counter m_active_time
Definition: pgstat.h:696
PgStat_GlobalStats * pgstat_fetch_global(void)
Definition: pgstat.c:2831
void pgstat_reset_replslot_counter(const char *name)
Definition: pgstat.c:1510
PgStat_SLRUStats * pgstat_fetch_slru(void)
Definition: pgstat.c:2863
PgStat_Counter n_tuples_returned
Definition: pgstat.h:760
struct PgStat_MsgReplSlot PgStat_MsgReplSlot
PgStat_Counter vacuum_count
Definition: pgstat.h:826
struct PgStat_MsgAnlAncestors PgStat_MsgAnlAncestors
bool m_autovacuum
Definition: pgstat.h:423
void pgstat_send_archiver(const char *xlog, bool failed)
Definition: pgstat.c:3003
size_t m_filesize
Definition: pgstat.h:586
PgStat_MsgTempFile msg_tempfile
Definition: pgstat.h:732
PgStat_Counter buf_fsync_backend
Definition: pgstat.h:881
struct PgStat_TableCounts PgStat_TableCounts
struct PgStat_MsgDummy PgStat_MsgDummy
TimestampTz stats_timestamp
Definition: pgstat.h:872
PgStat_Counter spill_txns
Definition: pgstat.h:923
TimestampTz stat_reset_timestamp
Definition: pgstat.h:786
PgStat_MsgWal msg_wal
Definition: pgstat.h:725
instr_time f_total_time
Definition: pgstat.h:602
void pgstat_reset_slru_counter(const char *)
Definition: pgstat.c:1486
struct PgStat_TableXactStatus * next
Definition: pgstat.h:198
struct PgStat_ReplSlotStats PgStat_ReplSlotStats
TimestampTz m_analyzetime
Definition: pgstat.h:442
void pgstat_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2631
PgStat_Counter numscans
Definition: pgstat.h:806
PgStat_TableCounts t_counts
Definition: pgstat.h:177
PgStat_Counter blocks_exists
Definition: pgstat.h:911
struct PgStat_MsgRecoveryConflict PgStat_MsgRecoveryConflict
unsigned int Oid
Definition: postgres_ext.h:31
struct PgStat_ArchiverStats PgStat_ArchiverStats
PgStat_Counter deleted_pre_trunc
Definition: pgstat.h:192
PgStat_Counter m_blocks_exists
Definition: pgstat.h:530
PgStat_MsgAnalyze msg_analyze
Definition: pgstat.h:721
PgStat_Counter tuples_hot_updated
Definition: pgstat.h:814
PgStat_Counter f_total_time
Definition: pgstat.h:846
PgStat_Counter spill_bytes
Definition: pgstat.h:925
PgStat_Counter t_tuples_returned
Definition: pgstat.h:119
void pgstat_report_wal(void)
Definition: pgstat.c:3059
PgStat_Shared_Reset_Target
Definition: pgstat.h:137
PgStat_Counter tuples_inserted
Definition: pgstat.h:811
PgStat_FunctionCounts * fs
Definition: pgstat.h:942
PgStat_Counter f_numcalls
Definition: pgstat.h:601
PgStat_Counter m_wal_sync_time
Definition: pgstat.h:514
PgStat_MsgHdr msg_hdr
Definition: pgstat.h:708
struct PgStat_StatFuncEntry PgStat_StatFuncEntry
struct PgStat_FunctionCallUsage PgStat_FunctionCallUsage
#define PGDLLIMPORT
Definition: c.h:1317
struct PgStat_SLRUStats PgStat_SLRUStats
PgStat_Counter m_stream_bytes
Definition: pgstat.h:550
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid)
Definition: pgstat.c:2728
PgStat_Counter n_xact_commit
Definition: pgstat.h:756
void pgstat_report_deadlock(void)
Definition: pgstat.c:1741
PgStat_MsgWal WalStats
Definition: pgstat.c:132
bool m_resetcounter
Definition: pgstat.h:441
PgStat_Counter stream_bytes
Definition: pgstat.h:928
PgStat_MsgBgWriter BgWriterStats
Definition: pgstat.c:131
PgStat_MsgHdr m_hdr
Definition: pgstat.h:524
PgStat_Counter n_blocks_fetched
Definition: pgstat.h:758
PgStat_Counter n_sessions_killed
Definition: pgstat.h:784
struct PgStat_TableEntry PgStat_TableEntry
const char * pgstat_slru_name(int slru_idx)
Definition: pgstat.c:5837
PgStat_Counter n_live_tuples
Definition: pgstat.h:816
PgStat_Counter m_requested_checkpoints
Definition: pgstat.h:488
PgStat_Counter inserts_since_vacuum
Definition: pgstat.h:820
Definition: dynahash.c:219
PgStat_MsgAnlAncestors msg_anl_ancestors
Definition: pgstat.h:722
Oid m_databaseid
Definition: pgstat.h:693
struct PgStat_MsgAnalyze PgStat_MsgAnalyze
unsigned short uint16
Definition: c.h:440
PgStat_MsgSLRU msg_slru
Definition: pgstat.h:726
PgStat_FunctionCounts f_counts
Definition: pgstat.h:613
PgStat_MsgHdr m_hdr
Definition: pgstat.h:669
PgStat_TableStatus * find_tabstat_entry(Oid rel_id)
Definition: pgstat.c:2148
PgStat_MsgFuncpurge msg_funcpurge
Definition: pgstat.h:729
char * pgstat_stat_tmpname
Definition: pgstat.c:124
PgStat_Counter buf_written_backend
Definition: pgstat.h:880
PgStat_RecoveryPrefetchStats * pgstat_fetch_recoveryprefetch(void)
Definition: pgstat.c:2896
PgStat_Counter n_conflict_tablespace
Definition: pgstat.h:766
PgStat_Counter m_spill_txns
Definition: pgstat.h:545
PgStat_Counter wal_write_time
Definition: pgstat.h:897
void AtEOSubXact_PgStat(bool isCommit, int nestDepth)
Definition: pgstat.c:2450
TimestampTz vacuum_timestamp
Definition: pgstat.h:825
PgStat_Counter t_tuples_updated
Definition: pgstat.h:123
PgStat_MsgHdr m_hdr
Definition: pgstat.h:384
NameData slotname
Definition: pgstat.h:922
PgStat_MsgHdr m_hdr
Definition: pgstat.h:571
PgStat_Counter total_active_time
Definition: pgstat.h:780
PgStat_Counter pgStatBlockReadTime
Definition: pgstat.c:246
void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type)
Definition: pgstat.c:1460
PgStat_Counter checkpoint_write_time
Definition: pgstat.h:875
PgStat_Counter n_sessions_abandoned
Definition: pgstat.h:782
PgStat_Counter n_dead_tuples
Definition: pgstat.h:817
PgStat_Counter m_index
Definition: pgstat.h:525
PgStat_Counter wal_fpi
Definition: pgstat.h:892
Definition: c.h:675
TimestampTz m_failure_time
Definition: pgstat.h:683
struct PgStat_MsgTempFile PgStat_MsgTempFile
void allow_immediate_pgstat_restart(void)
Definition: pgstat.c:820
PgStat_Counter f_numcalls
Definition: pgstat.h:844
TimestampTz last_autovac_time
Definition: pgstat.h:765
struct PgStat_GlobalStats PgStat_GlobalStats
void pgstat_count_slru_page_read(int slru_idx)
Definition: pgstat.c:5888
PgStat_Counter m_blocks_written
Definition: pgstat.h:529
PgStat_Counter n_sessions_fatal
Definition: pgstat.h:783
PgStat_Counter n_tuples_inserted
Definition: pgstat.h:762
Oid m_databaseid
Definition: pgstat.h:338
PgStat_Counter buf_written_checkpoints
Definition: pgstat.h:877
PgStat_Counter tuples_inserted
Definition: pgstat.h:186
struct PgStat_MsgDropdb PgStat_MsgDropdb
PgStat_Counter pgStatBlockWriteTime
Definition: pgstat.c:247
struct PgStat_MsgSLRU PgStat_MsgSLRU
void pgstat_report_anl_ancestors(Oid relid)
Definition: pgstat.c:1682
PgStat_Counter skip_hit
Definition: pgstat.h:208
struct PgStat_MsgInquiry PgStat_MsgInquiry
void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
Definition: pgstat.c:1967
char * pgstat_stat_directory
Definition: pgstat.c:122
PgStat_Counter blocks_read
Definition: pgstat.h:909
PgStat_Counter total_idle_in_xact_time
Definition: pgstat.h:781
void pgstat_report_stat(bool force)
Definition: pgstat.c:846
PgStat_RecoveryPrefetchStats m_stats
Definition: pgstat.h:562
void pgstat_vacuum_stat(void)
Definition: pgstat.c:1067
PgStat_Counter m_wal_write_time
Definition: pgstat.h:512
PgStat_Counter t_delta_dead_tuples
Definition: pgstat.h:129
SessionEndType
Definition: pgstat.h:44
PgStat_Counter tuples_fetched
Definition: pgstat.h:809
void pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
Definition: pgstat.c:2217
unsigned int uint32
Definition: c.h:441
PgStat_Counter n_conflict_snapshot
Definition: pgstat.h:768
PgStat_MsgHdr m_hdr
Definition: pgstat.h:337
PgStat_Counter m_block_write_time
Definition: pgstat.h:307
PgStat_Counter n_tuples_deleted
Definition: pgstat.h:764
TimestampTz stat_reset_timestamp
Definition: pgstat.h:212
void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2667
PgStat_Counter n_conflict_lock
Definition: pgstat.h:767
PgStat_Counter blocks_hit
Definition: pgstat.h:908
PgStat_Counter total_session_time
Definition: pgstat.h:779
PgStat_Counter t_blocks_hit
Definition: pgstat.h:133
PgStat_Counter pgStatActiveTime
Definition: pgstat.c:248
void pgstat_init(void)
Definition: pgstat.c:380
struct PgStat_WalStats PgStat_WalStats
struct PgStat_TableXactStatus * upper
Definition: pgstat.h:195
PgStat_Counter n_xact_rollback
Definition: pgstat.h:757
PgStat_Counter m_wal_buffers_full
Definition: pgstat.h:509
int m_xact_rollback
Definition: pgstat.h:305
PgStat_MsgHdr m_hdr
Definition: pgstat.h:349
SessionEndType pgStatSessionEndCause
Definition: pgstat.c:250
PgStat_Counter t_tuples_deleted
Definition: pgstat.h:124
PgStat_Counter buf_written_clean
Definition: pgstat.h:878
void AtEOXact_PgStat(bool isCommit, bool parallel)
Definition: pgstat.c:2363
void pgstat_report_recovery_conflict(int reason)
Definition: pgstat.c:1721
PgStat_Counter blocks_zeroed
Definition: pgstat.h:907
PgStat_MsgRecoveryConflict msg_recoveryconflict
Definition: pgstat.h:730
struct PgStat_MsgTabstat PgStat_MsgTabstat
PgStat_MsgHdr m_hdr
Definition: pgstat.h:323
struct PgStat_MsgRecoveryPrefetch PgStat_MsgRecoveryPrefetch
PgStat_Counter m_idle_in_xact_time
Definition: pgstat.h:697
PgStat_Counter m_wal_write
Definition: pgstat.h:510
PgStat_Counter m_live_tuples
Definition: pgstat.h:443
void pgstat_drop_database(Oid databaseid)
Definition: pgstat.c:1298
void pgstat_count_slru_truncate(int slru_idx)
Definition: pgstat.c:5906
struct PgStat_MsgResetsharedcounter PgStat_MsgResetsharedcounter
struct PgStat_FunctionCounts PgStat_FunctionCounts
bool m_autovacuum
Definition: pgstat.h:440
#define PGSTAT_NUM_FUNCENTRIES
Definition: pgstat.h:633
PgStat_Counter tuples_deleted
Definition: pgstat.h:188
PgStat_Counter skip_new
Definition: pgstat.h:209
struct PgStat_MsgBgWriter PgStat_MsgBgWriter
TimestampTz m_timestamp
Definition: pgstat.h:476
#define PGSTAT_NUM_TABENTRIES
Definition: pgstat.h:295
struct PgStat_MsgResetsinglecounter PgStat_MsgResetsinglecounter
void pgstat_reset_counters(void)
Definition: pgstat.c:1396
#define MAX_XFN_CHARS
Definition: pgarch.h:26
PgStat_Counter f_total_time
Definition: pgstat.h:624
PgStat_Counter blocks_hit
Definition: pgstat.h:823
TimestampTz analyze_timestamp
Definition: pgstat.h:829
TimestampTz last_failed_timestamp
Definition: pgstat.h:863
PgStat_Counter changes_since_analyze
Definition: pgstat.h:818
StatMsgType
Definition: pgstat.h:57
PgStat_Shared_Reset_Target m_resettarget
Definition: pgstat.h:361
PgStat_MsgHdr m_hdr
Definition: pgstat.h:460
void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples)
Definition: pgstat.c:1585
PgStat_Counter t_numscans
Definition: pgstat.h:117
struct PgStat_MsgVacuum PgStat_MsgVacuum
PgStat_Single_Reset_Type
Definition: pgstat.h:145
struct PgStat_TableXactStatus PgStat_TableXactStatus
PGDLLIMPORT bool pgstat_track_counts
Definition: pgstat.c:115
PgStat_Counter n_tuples_updated
Definition: pgstat.h:763
PgStat_Counter pgStatTransactionIdleTime
Definition: pgstat.c:249
PgStat_Counter skip_fpw
Definition: pgstat.h:210
uint64 wal_bytes
Definition: pgstat.h:893
PgStat_Counter m_stream_txns
Definition: pgstat.h:548
void pgstat_report_replslot_drop(const char *slotname)
Definition: pgstat.c:1844
char * pgstat_stat_filename
Definition: pgstat.c:123
PgStat_MsgHdr m_hdr
Definition: pgstat.h:248
PgStat_Counter t_changed_tuples
Definition: pgstat.h:130
struct PgStat_MsgWal PgStat_MsgWal
PgStat_MsgTabstat msg_tabstat
Definition: pgstat.h:711
PgStat_MsgHdr m_hdr
Definition: pgstat.h:301
void pgstat_send_bgwriter(void)
Definition: pgstat.c:3024
struct PgStat_MsgChecksumFailure PgStat_MsgChecksumFailure
PgStat_Counter m_checkpoint_sync_time
Definition: pgstat.h:496
PgStat_MsgVacuum msg_vacuum
Definition: pgstat.h:720
PgStat_MsgHdr m_hdr
Definition: pgstat.h:639
PgStat_Counter n_sessions
Definition: pgstat.h:778
void pgstat_report_replslot(const PgStat_ReplSlotStats *repSlotStat)
Definition: pgstat.c:1816
PgStat_Counter failed_count
Definition: pgstat.h:860
PgStat_StatDBEntry * pgstat_fetch_stat_dbentry(Oid dbid)
Definition: pgstat.c:2701
PgStat_Counter n_block_write_time
Definition: pgstat.h:777
PgStat_Counter m_buf_written_backend
Definition: pgstat.h:492
PgStat_Counter m_blocks_read
Definition: pgstat.h:528
PgStat_MsgHdr m_hdr
Definition: pgstat.h:420
PgStat_Counter m_total_txns
Definition: pgstat.h:551
void pgstat_count_heap_delete(Relation rel)
Definition: pgstat.c:2263
PgStat_Counter tuples_deleted
Definition: pgstat.h:813
struct PgStat_StatTabEntry PgStat_StatTabEntry
PgStat_Counter m_wal_fpi
Definition: pgstat.h:507
PgStat_TableCounts t_counts
Definition: pgstat.h:287
PgStat_Counter flush
Definition: pgstat.h:912
void pgstat_count_slru_flush(int slru_idx)
Definition: pgstat.c:5900
PgStat_Counter inserted_pre_trunc
Definition: pgstat.h:190
PgStat_Counter tuples_updated
Definition: pgstat.h:812
PgStat_Counter checkpoint_sync_time
Definition: pgstat.h:876
PgStat_Counter m_spill_count
Definition: pgstat.h:546
PgStat_MsgConn msg_conn
Definition: pgstat.h:735
PgStat_Counter m_total_bytes
Definition: pgstat.h:552
struct PgStat_FunctionEntry PgStat_FunctionEntry
TimestampTz autovac_vacuum_timestamp
Definition: pgstat.h:827
PgStat_Counter maxwritten_clean
Definition: pgstat.h:879
PgStat_Counter n_block_read_time
Definition: pgstat.h:776
PgStat_Counter prefetch
Definition: pgstat.h:207
PgStat_Counter m_block_read_time
Definition: pgstat.h:306
struct PgStat_MsgFuncstat PgStat_MsgFuncstat
const char * name
Definition: encode.c:515
TimestampTz stat_reset_timestamp
Definition: pgstat.h:883
struct PgStat_TableXactStatus * trans
Definition: pgstat.h:176
struct PgStat_TableStatus PgStat_TableStatus
PgStat_MsgResetreplslotcounter msg_resetreplslotcounter
Definition: pgstat.h:718
struct PgStat_StatDBEntry PgStat_StatDBEntry
PgStat_Counter autovac_analyze_count
Definition: pgstat.h:832
void pgstat_report_autovac(Oid dboid)
Definition: pgstat.c:1563
int pgstat_slru_index(const char *name)
Definition: pgstat.c:5815
PgStat_Counter updated_pre_trunc
Definition: pgstat.h:191
void pgstat_count_slru_page_hit(int slru_idx)
Definition: pgstat.c:5876
PgStat_MsgHdr m_hdr
Definition: pgstat.h:437
void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
Definition: pgstat.c:1762
PgStat_Counter changes_since_analyze_reported
Definition: pgstat.h:819
void pgstat_count_heap_update(Relation rel, bool hot)
Definition: pgstat.c:2238
PgStat_BackendFunctionEntry * find_funcstat_entry(Oid func_id)
Definition: pgstat.c:1947
PgStat_Counter total_bytes
Definition: pgstat.h:930
void pgstat_init_function_usage(struct FunctionCallInfoBaseData *fcinfo, PgStat_FunctionCallUsage *fcu)
PgStat_Counter m_session_time
Definition: pgstat.h:695
TimestampTz cutoff_time
Definition: pgstat.h:275
TimestampTz stat_reset_timestamp
Definition: pgstat.h:864
TimestampTz last_archived_timestamp
Definition: pgstat.h:859
TimestampTz m_start_time
Definition: pgstat.h:409
PgStat_Counter n_deadlocks
Definition: pgstat.h:773
struct PgStat_MsgConn PgStat_MsgConn
struct PgStat_MsgResetslrucounter PgStat_MsgResetslrucounter
struct PgStat_MsgAutovacStart PgStat_MsgAutovacStart
PgStat_MsgArchiver msg_archiver
Definition: pgstat.h:723
PgStat_Counter skip_seq
Definition: pgstat.h:211
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples, bool resetcounter)
Definition: pgstat.c:1616
PgStat_MsgResetsinglecounter msg_resetsinglecounter
Definition: pgstat.h:716
PgStat_Counter requested_checkpoints
Definition: pgstat.h:874
StatMsgType m_type
Definition: pgstat.h:227
PgStat_MsgHdr m_hdr
Definition: pgstat.h:542
PgStat_StatFuncEntry * pgstat_fetch_stat_funcentry(Oid funcid)
Definition: pgstat.c:2784
instr_time save_f_total_time
Definition: pgstat.h:944
PgStat_MsgResetcounter msg_resetcounter
Definition: pgstat.h:714
void pgstat_reset_all(void)
Definition: pgstat.c:715
PgStat_WalStats * pgstat_fetch_stat_wal(void)
Definition: pgstat.c:2847
PgStat_Counter m_stream_count
Definition: pgstat.h:549
bool pgstat_send_wal(bool force)
Definition: pgstat.c:3099
PgStat_Counter m_blocks_zeroed
Definition: pgstat.h:526
NameData m_slotname
Definition: pgstat.h:543
PgStat_MsgReplSlot msg_replslot
Definition: pgstat.h:734
PgStat_Counter f_numcalls
Definition: pgstat.h:623
struct PgStat_MsgResetcounter PgStat_MsgResetcounter
PgStat_Counter wal_buffers_full
Definition: pgstat.h:894
PgStat_Counter f_self_time
Definition: pgstat.h:847
PgStat_Counter m_dead_tuples
Definition: pgstat.h:444
PgStat_Counter wal_sync
Definition: pgstat.h:896
PgStat_ReplSlotStats * pgstat_fetch_replslot(int *nslots_p)
Definition: pgstat.c:2880
PgStat_Counter blocks_fetched
Definition: pgstat.h:822
PgStat_Counter m_truncate
Definition: pgstat.h:532
void AtPrepare_PgStat(void)
Definition: pgstat.c:2549
struct PgStat_BackendFunctionEntry PgStat_BackendFunctionEntry
struct PgStat_MsgHdr PgStat_MsgHdr
PgStat_MsgInquiry msg_inquiry
Definition: pgstat.h:710
PgStat_Counter truncate
Definition: pgstat.h:913
PgStat_MsgDropdb msg_dropdb
Definition: pgstat.h:713
int m_size
Definition: pgstat.h:228
PgStat_Single_Reset_Type m_resettype
Definition: pgstat.h:373
void pgstat_initstats(Relation rel)
Definition: pgstat.c:2024
PgStat_Counter m_count
Definition: pgstat.h:694
void pgstat_count_slru_page_zeroed(int slru_idx)
Definition: pgstat.c:5870
PgStat_Counter t_tuples_inserted
Definition: pgstat.h:122
void pgstat_reset_shared_counters(const char *)
Definition: pgstat.c:1418
PgStat_Counter spill_count
Definition: pgstat.h:924
#define PGSTAT_NUM_ANCESTORENTRIES
Definition: pgstat.h:454
PgStat_Counter blocks_written
Definition: pgstat.h:910
PgStat_MsgTabpurge msg_tabpurge
Definition: pgstat.h:712
#define PGSTAT_NUM_FUNCPURGE
Definition: pgstat.h:650
PgStat_TableStatus * parent
Definition: pgstat.h:196
PGDLLIMPORT int pgstat_track_functions
Definition: pgstat.c:116
PgStat_Counter t_blocks_fetched
Definition: pgstat.h:132
PgStat_MsgHdr m_hdr
Definition: pgstat.h:473
void PostPrepare_PgStat(void)
Definition: pgstat.c:2598
PgStat_MsgFuncstat msg_funcstat
Definition: pgstat.h:728
void pgstat_send_recoveryprefetch(PgStat_RecoveryPrefetchStats *stats)
Definition: pgstat.c:3186
PgStat_Counter m_blocks_hit
Definition: pgstat.h:527
PgStat_Counter n_tuples_fetched
Definition: pgstat.h:761
PgStat_Counter autovac_vacuum_count
Definition: pgstat.h:828
PgStat_MsgHdr m_hdr
Definition: pgstat.h:273
PgStat_Counter m_wal_records
Definition: pgstat.h:506
SessionEndType m_disconnect
Definition: pgstat.h:698
PgStat_Counter n_temp_bytes
Definition: pgstat.h:772
PgStat_Counter stream_txns
Definition: pgstat.h:926