PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2016, 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 "fmgr.h"
16 #include "libpq/pqcomm.h"
17 #include "portability/instr_time.h"
18 #include "postmaster/pgarch.h"
19 #include "storage/barrier.h"
20 #include "storage/proc.h"
21 #include "utils/hsearch.h"
22 #include "utils/relcache.h"
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 /* ----------
45  * The types of backend -> collector messages
46  * ----------
47  */
48 typedef enum StatMsgType
49 {
68 } StatMsgType;
69 
70 /* ----------
71  * The data type used for counters.
72  * ----------
73  */
74 typedef int64 PgStat_Counter;
75 
76 /* ----------
77  * PgStat_TableCounts The actual per-table counts kept by a backend
78  *
79  * This struct should contain only actual event counters, because we memcmp
80  * it against zeroes to detect whether there are any counts to transmit.
81  * It is a component of PgStat_TableStatus (within-backend state) and
82  * PgStat_TableEntry (the transmitted message format).
83  *
84  * Note: for a table, tuples_returned is the number of tuples successfully
85  * fetched by heap_getnext, while tuples_fetched is the number of tuples
86  * successfully fetched by heap_fetch under the control of bitmap indexscans.
87  * For an index, tuples_returned is the number of index entries returned by
88  * the index AM, while tuples_fetched is the number of tuples successfully
89  * fetched by heap_fetch under the control of simple indexscans for this index.
90  *
91  * tuples_inserted/updated/deleted/hot_updated count attempted actions,
92  * regardless of whether the transaction committed. delta_live_tuples,
93  * delta_dead_tuples, and changed_tuples are set depending on commit or abort.
94  * Note that delta_live_tuples and delta_dead_tuples can be negative!
95  * ----------
96  */
97 typedef struct PgStat_TableCounts
98 {
100 
103 
109 
113 
117 
118 /* Possible targets for resetting cluster-wide shared values */
120 {
124 
125 /* Possible object types for resetting single counters */
127 {
131 
132 /* ------------------------------------------------------------
133  * Structures kept in backend local memory while accumulating counts
134  * ------------------------------------------------------------
135  */
136 
137 
138 /* ----------
139  * PgStat_TableStatus Per-table status within a backend
140  *
141  * Many of the event counters are nontransactional, ie, we count events
142  * in committed and aborted transactions alike. For these, we just count
143  * directly in the PgStat_TableStatus. However, delta_live_tuples,
144  * delta_dead_tuples, and changed_tuples must be derived from event counts
145  * with awareness of whether the transaction or subtransaction committed or
146  * aborted. Hence, we also keep a stack of per-(sub)transaction status
147  * records for every table modified in the current transaction. At commit
148  * or abort, we propagate tuples_inserted/updated/deleted up to the
149  * parent subtransaction level, or out to the parent PgStat_TableStatus,
150  * as appropriate.
151  * ----------
152  */
153 typedef struct PgStat_TableStatus
154 {
155  Oid t_id; /* table's OID */
156  bool t_shared; /* is it a shared catalog? */
157  struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */
158  PgStat_TableCounts t_counts; /* event counts to be sent */
160 
161 /* ----------
162  * PgStat_TableXactStatus Per-table, per-subtransaction status
163  * ----------
164  */
166 {
167  PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
168  PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
169  PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
170  bool truncated; /* relation truncated in this (sub)xact */
171  PgStat_Counter inserted_pre_trunc; /* tuples inserted prior to truncate */
172  PgStat_Counter updated_pre_trunc; /* tuples updated prior to truncate */
173  PgStat_Counter deleted_pre_trunc; /* tuples deleted prior to truncate */
174  int nest_level; /* subtransaction nest level */
175  /* links to other structs for same relation: */
176  struct PgStat_TableXactStatus *upper; /* next higher subxact if any */
177  PgStat_TableStatus *parent; /* per-table status */
178  /* structs of same subxact level are linked here: */
179  struct PgStat_TableXactStatus *next; /* next of same subxact */
181 
182 
183 /* ------------------------------------------------------------
184  * Message formats follow
185  * ------------------------------------------------------------
186  */
187 
188 
189 /* ----------
190  * PgStat_MsgHdr The common message header
191  * ----------
192  */
193 typedef struct PgStat_MsgHdr
194 {
196  int m_size;
197 } PgStat_MsgHdr;
198 
199 /* ----------
200  * Space available in a message. This will keep the UDP packets below 1K,
201  * which should fit unfragmented into the MTU of the loopback interface.
202  * (Larger values of PGSTAT_MAX_MSG_SIZE would work for that on most
203  * platforms, but we're being conservative here.)
204  * ----------
205  */
206 #define PGSTAT_MAX_MSG_SIZE 1000
207 #define PGSTAT_MSG_PAYLOAD (PGSTAT_MAX_MSG_SIZE - sizeof(PgStat_MsgHdr))
208 
209 
210 /* ----------
211  * PgStat_MsgDummy A dummy message, ignored by the collector
212  * ----------
213  */
214 typedef struct PgStat_MsgDummy
215 {
218 
219 
220 /* ----------
221  * PgStat_MsgInquiry Sent by a backend to ask the collector
222  * to write the stats file.
223  * ----------
224  */
225 
226 typedef struct PgStat_MsgInquiry
227 {
229  TimestampTz clock_time; /* observed local clock time */
230  TimestampTz cutoff_time; /* minimum acceptable file timestamp */
231  Oid databaseid; /* requested DB (InvalidOid => all DBs) */
233 
234 
235 /* ----------
236  * PgStat_TableEntry Per-table info in a MsgTabstat
237  * ----------
238  */
239 typedef struct PgStat_TableEntry
240 {
244 
245 /* ----------
246  * PgStat_MsgTabstat Sent by the backend to report table
247  * and buffer access statistics.
248  * ----------
249  */
250 #define PGSTAT_NUM_TABENTRIES \
251  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int) - 2 * sizeof(PgStat_Counter)) \
252  / sizeof(PgStat_TableEntry))
253 
254 typedef struct PgStat_MsgTabstat
255 {
261  PgStat_Counter m_block_read_time; /* times in microseconds */
265 
266 
267 /* ----------
268  * PgStat_MsgTabpurge Sent by the backend to tell the collector
269  * about dead tables.
270  * ----------
271  */
272 #define PGSTAT_NUM_TABPURGE \
273  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
274  / sizeof(Oid))
275 
276 typedef struct PgStat_MsgTabpurge
277 {
283 
284 
285 /* ----------
286  * PgStat_MsgDropdb Sent by the backend to tell the collector
287  * about a dropped database
288  * ----------
289  */
290 typedef struct PgStat_MsgDropdb
291 {
295 
296 
297 /* ----------
298  * PgStat_MsgResetcounter Sent by the backend to tell the collector
299  * to reset counters
300  * ----------
301  */
303 {
307 
308 /* ----------
309  * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector
310  * to reset a shared counter
311  * ----------
312  */
314 {
318 
319 /* ----------
320  * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector
321  * to reset a single counter
322  * ----------
323  */
325 {
331 
332 /* ----------
333  * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal
334  * that a database is going to be processed
335  * ----------
336  */
338 {
343 
344 
345 /* ----------
346  * PgStat_MsgVacuum Sent by the backend or autovacuum daemon
347  * after VACUUM
348  * ----------
349  */
350 typedef struct PgStat_MsgVacuum
351 {
360 
361 
362 /* ----------
363  * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon
364  * after ANALYZE
365  * ----------
366  */
367 typedef struct PgStat_MsgAnalyze
368 {
377 
378 
379 /* ----------
380  * PgStat_MsgArchiver Sent by the archiver to update statistics.
381  * ----------
382  */
383 typedef struct PgStat_MsgArchiver
384 {
386  bool m_failed; /* Failed attempt */
390 
391 /* ----------
392  * PgStat_MsgBgWriter Sent by the bgwriter to update statistics.
393  * ----------
394  */
395 typedef struct PgStat_MsgBgWriter
396 {
398 
407  PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */
410 
411 /* ----------
412  * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict
413  * ----------
414  */
416 {
418 
420  int m_reason;
422 
423 /* ----------
424  * PgStat_MsgTempFile Sent by the backend upon creating a temp file
425  * ----------
426  */
427 typedef struct PgStat_MsgTempFile
428 {
430 
432  size_t m_filesize;
434 
435 /* ----------
436  * PgStat_FunctionCounts The actual per-function counts kept by a backend
437  *
438  * This struct should contain only actual event counters, because we memcmp
439  * it against zeroes to detect whether there are any counts to transmit.
440  *
441  * Note that the time counters are in instr_time format here. We convert to
442  * microseconds in PgStat_Counter format when transmitting to the collector.
443  * ----------
444  */
445 typedef struct PgStat_FunctionCounts
446 {
451 
452 /* ----------
453  * PgStat_BackendFunctionEntry Entry in backend's per-function hash table
454  * ----------
455  */
457 {
461 
462 /* ----------
463  * PgStat_FunctionEntry Per-function info in a MsgFuncstat
464  * ----------
465  */
466 typedef struct PgStat_FunctionEntry
467 {
470  PgStat_Counter f_total_time; /* times in microseconds */
473 
474 /* ----------
475  * PgStat_MsgFuncstat Sent by the backend to report function
476  * usage statistics.
477  * ----------
478  */
479 #define PGSTAT_NUM_FUNCENTRIES \
480  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
481  / sizeof(PgStat_FunctionEntry))
482 
483 typedef struct PgStat_MsgFuncstat
484 {
490 
491 /* ----------
492  * PgStat_MsgFuncpurge Sent by the backend to tell the collector
493  * about dead functions.
494  * ----------
495  */
496 #define PGSTAT_NUM_FUNCPURGE \
497  ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
498  / sizeof(Oid))
499 
500 typedef struct PgStat_MsgFuncpurge
501 {
507 
508 /* ----------
509  * PgStat_MsgDeadlock Sent by the backend to tell the collector
510  * about a deadlock that occurred.
511  * ----------
512  */
513 typedef struct PgStat_MsgDeadlock
514 {
518 
519 
520 /* ----------
521  * PgStat_Msg Union over all possible messages.
522  * ----------
523  */
524 typedef union PgStat_Msg
525 {
544 } PgStat_Msg;
545 
546 
547 /* ------------------------------------------------------------
548  * Statistic collector data structures follow
549  *
550  * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these
551  * data structures change.
552  * ------------------------------------------------------------
553  */
554 
555 #define PGSTAT_FILE_FORMAT_ID 0x01A5BC9D
556 
557 /* ----------
558  * PgStat_StatDBEntry The collector's data per database
559  * ----------
560  */
561 typedef struct PgStat_StatDBEntry
562 {
582  PgStat_Counter n_block_read_time; /* times in microseconds */
584 
586  TimestampTz stats_timestamp; /* time of db stats file update */
587 
588  /*
589  * tables and functions must be last in the struct, because we don't write
590  * the pointers out to the stats file.
591  */
595 
596 
597 /* ----------
598  * PgStat_StatTabEntry The collector's data per table (or index)
599  * ----------
600  */
601 typedef struct PgStat_StatTabEntry
602 {
604 
606 
609 
614 
618 
621 
622  TimestampTz vacuum_timestamp; /* user initiated vacuum */
624  TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */
626  TimestampTz analyze_timestamp; /* user initiated */
628  TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */
631 
632 
633 /* ----------
634  * PgStat_StatFuncEntry The collector's data per function
635  * ----------
636  */
637 typedef struct PgStat_StatFuncEntry
638 {
640 
642 
643  PgStat_Counter f_total_time; /* times in microseconds */
646 
647 
648 /*
649  * Archiver statistics kept in the stats collector
650  */
651 typedef struct PgStat_ArchiverStats
652 {
653  PgStat_Counter archived_count; /* archival successes */
654  char last_archived_wal[MAX_XFN_CHARS + 1]; /* last WAL file
655  * archived */
656  TimestampTz last_archived_timestamp; /* last archival success time */
657  PgStat_Counter failed_count; /* failed archival attempts */
658  char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in
659  * last failure */
660  TimestampTz last_failed_timestamp; /* last archival failure time */
663 
664 /*
665  * Global statistics kept in the stats collector
666  */
667 typedef struct PgStat_GlobalStats
668 {
669  TimestampTz stats_timestamp; /* time of stats file update */
672  PgStat_Counter checkpoint_write_time; /* times in milliseconds */
682 
683 
684 /* ----------
685  * Backend states
686  * ----------
687  */
688 typedef enum BackendState
689 {
697 } BackendState;
698 
699 
700 /* ----------
701  * Wait Classes
702  * ----------
703  */
704 typedef enum WaitClass
705 {
711 } WaitClass;
712 
713 
714 /* ----------
715  * Command type for progress reporting purposes
716  * ----------
717  */
719 {
723 
724 #define PGSTAT_NUM_PROGRESS_PARAM 10
725 
726 /* ----------
727  * Shared-memory data structures
728  * ----------
729  */
730 
731 
732 /*
733  * PgBackendSSLStatus
734  *
735  * For each backend, we keep the SSL status in a separate struct, that
736  * is only filled in if SSL is enabled.
737  */
738 typedef struct PgBackendSSLStatus
739 {
740  /* Information about SSL connection */
741  int ssl_bits;
743  char ssl_version[NAMEDATALEN]; /* MUST be null-terminated */
744  char ssl_cipher[NAMEDATALEN]; /* MUST be null-terminated */
745  char ssl_clientdn[NAMEDATALEN]; /* MUST be null-terminated */
747 
748 
749 /* ----------
750  * PgBackendStatus
751  *
752  * Each live backend maintains a PgBackendStatus struct in shared memory
753  * showing its current activity. (The structs are allocated according to
754  * BackendId, but that is not critical.) Note that the collector process
755  * has no involvement in, or even access to, these structs.
756  * ----------
757  */
758 typedef struct PgBackendStatus
759 {
760  /*
761  * To avoid locking overhead, we use the following protocol: a backend
762  * increments st_changecount before modifying its entry, and again after
763  * finishing a modification. A would-be reader should note the value of
764  * st_changecount, copy the entry into private memory, then check
765  * st_changecount again. If the value hasn't changed, and if it's even,
766  * the copy is valid; otherwise start over. This makes updates cheap
767  * while reads are potentially expensive, but that's the tradeoff we want.
768  *
769  * The above protocol needs the memory barriers to ensure that the
770  * apparent order of execution is as it desires. Otherwise, for example,
771  * the CPU might rearrange the code so that st_changecount is incremented
772  * twice before the modification on a machine with weak memory ordering.
773  * This surprising result can lead to bugs.
774  */
776 
777  /* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */
779 
780  /* Times when current backend, transaction, and activity started */
785 
786  /* Database OID, owning user's OID, connection client address */
790  char *st_clienthostname; /* MUST be null-terminated */
791 
792  /* Information about SSL connection */
793  bool st_ssl;
795 
796  /* current state */
798 
799  /* application name; MUST be null-terminated */
800  char *st_appname;
801 
802  /* current command string; MUST be null-terminated */
803  char *st_activity;
804 
805  /*
806  * Command progress reporting. Any command which wishes can advertise
807  * that it is running by setting st_progress_command,
808  * st_progress_command_target, and st_progress_command[].
809  * st_progress_command_target should be the OID of the relation which the
810  * command targets (we assume there's just one, as this is meant for
811  * utility commands), but the meaning of each element in the
812  * st_progress_param array is command-specific.
813  */
818 
819 /*
820  * Macros to load and store st_changecount with the memory barriers.
821  *
822  * pgstat_increment_changecount_before() and
823  * pgstat_increment_changecount_after() need to be called before and after
824  * PgBackendStatus entries are modified, respectively. This makes sure that
825  * st_changecount is incremented around the modification.
826  *
827  * Also pgstat_save_changecount_before() and pgstat_save_changecount_after()
828  * need to be called before and after PgBackendStatus entries are copied into
829  * private memory, respectively.
830  */
831 #define pgstat_increment_changecount_before(beentry) \
832  do { \
833  beentry->st_changecount++; \
834  pg_write_barrier(); \
835  } while (0)
836 
837 #define pgstat_increment_changecount_after(beentry) \
838  do { \
839  pg_write_barrier(); \
840  beentry->st_changecount++; \
841  Assert((beentry->st_changecount & 1) == 0); \
842  } while (0)
843 
844 #define pgstat_save_changecount_before(beentry, save_changecount) \
845  do { \
846  save_changecount = beentry->st_changecount; \
847  pg_read_barrier(); \
848  } while (0)
849 
850 #define pgstat_save_changecount_after(beentry, save_changecount) \
851  do { \
852  pg_read_barrier(); \
853  save_changecount = beentry->st_changecount; \
854  } while (0)
855 
856 /* ----------
857  * LocalPgBackendStatus
858  *
859  * When we build the backend status array, we use LocalPgBackendStatus to be
860  * able to add new values to the struct when needed without adding new fields
861  * to the shared memory. It contains the backend status as a first member.
862  * ----------
863  */
864 typedef struct LocalPgBackendStatus
865 {
866  /*
867  * Local version of the backend status entry.
868  */
870 
871  /*
872  * The xid of the current transaction if available, InvalidTransactionId
873  * if not.
874  */
876 
877  /*
878  * The xmin of the current session if available, InvalidTransactionId if
879  * not.
880  */
883 
884 /*
885  * Working state needed to accumulate per-function-call timing statistics.
886  */
888 {
889  /* Link to function's hashtable entry (must still be there at exit!) */
890  /* NULL means we are not tracking the current function call */
892  /* Total time previously charged to function, as of function start */
894  /* Backend-wide total time as of function start */
896  /* system clock as of function start */
899 
900 
901 /* ----------
902  * GUC parameters
903  * ----------
904  */
905 extern bool pgstat_track_activities;
906 extern bool pgstat_track_counts;
907 extern int pgstat_track_functions;
909 extern char *pgstat_stat_directory;
910 extern char *pgstat_stat_tmpname;
911 extern char *pgstat_stat_filename;
912 
913 /*
914  * BgWriter statistics counters are updated directly by bgwriter and bufmgr
915  */
917 
918 /*
919  * Updated by pgstat_count_buffer_*_time macros
920  */
923 
924 /* ----------
925  * Functions called from postmaster
926  * ----------
927  */
928 extern Size BackendStatusShmemSize(void);
929 extern void CreateSharedBackendStatus(void);
930 
931 extern void pgstat_init(void);
932 extern int pgstat_start(void);
933 extern void pgstat_reset_all(void);
934 extern void allow_immediate_pgstat_restart(void);
935 
936 #ifdef EXEC_BACKEND
937 extern void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn();
938 #endif
939 
940 
941 /* ----------
942  * Functions called from backends
943  * ----------
944  */
945 extern void pgstat_ping(void);
946 
947 extern void pgstat_report_stat(bool force);
948 extern void pgstat_vacuum_stat(void);
949 extern void pgstat_drop_database(Oid databaseid);
950 
951 extern void pgstat_clear_snapshot(void);
952 extern void pgstat_reset_counters(void);
953 extern void pgstat_reset_shared_counters(const char *);
954 extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type);
955 
956 extern void pgstat_report_autovac(Oid dboid);
957 extern void pgstat_report_vacuum(Oid tableoid, bool shared,
958  PgStat_Counter livetuples, PgStat_Counter deadtuples);
959 extern void pgstat_report_analyze(Relation rel,
960  PgStat_Counter livetuples, PgStat_Counter deadtuples);
961 
962 extern void pgstat_report_recovery_conflict(int reason);
963 extern void pgstat_report_deadlock(void);
964 
965 extern void pgstat_initialize(void);
966 extern void pgstat_bestart(void);
967 
968 extern void pgstat_report_activity(BackendState state, const char *cmd_str);
969 extern void pgstat_report_tempfile(size_t filesize);
970 extern void pgstat_report_appname(const char *appname);
971 extern void pgstat_report_xact_timestamp(TimestampTz tstamp);
972 extern const char *pgstat_get_wait_event(uint32 wait_event_info);
973 extern const char *pgstat_get_wait_event_type(uint32 wait_event_info);
974 extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser);
975 extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer,
976  int buflen);
977 
979  Oid relid);
980 extern void pgstat_progress_update_param(int index, int64 val);
981 extern void pgstat_progress_update_multi_param(int nparam, const int *index,
982  const int64 *val);
983 extern void pgstat_progress_end_command(void);
984 
987 
988 extern void pgstat_initstats(Relation rel);
989 
990 /* ----------
991  * pgstat_report_wait_start() -
992  *
993  * Called from places where server process needs to wait. This is called
994  * to report wait event information. The wait information is stored
995  * as 4-bytes where first byte repersents the wait event class (type of
996  * wait, for different types of wait, refer WaitClass) and the next
997  * 3-bytes repersent the actual wait event. Currently 2-bytes are used
998  * for wait event which is sufficient for current usage, 1-byte is
999  * reserved for future usage.
1000  *
1001  * NB: this *must* be able to survive being called before MyProc has been
1002  * initialized.
1003  * ----------
1004  */
1005 static inline void
1007 {
1008  volatile PGPROC *proc = MyProc;
1009  uint32 wait_event_val;
1010 
1011  if (!pgstat_track_activities || !proc)
1012  return;
1013 
1014  wait_event_val = classId;
1015  wait_event_val <<= 24;
1016  wait_event_val |= eventId;
1017 
1018  /*
1019  * Since this is a four-byte field which is always read and written as
1020  * four-bytes, updates are atomic.
1021  */
1022  proc->wait_event_info = wait_event_val;
1023 }
1024 
1025 /* ----------
1026  * pgstat_report_wait_end() -
1027  *
1028  * Called to report end of a wait.
1029  *
1030  * NB: this *must* be able to survive being called before MyProc has been
1031  * initialized.
1032  * ----------
1033  */
1034 static inline void
1036 {
1037  volatile PGPROC *proc = MyProc;
1038 
1039  if (!pgstat_track_activities || !proc)
1040  return;
1041 
1042  /*
1043  * Since this is a four-byte field which is always read and written as
1044  * four-bytes, updates are atomic.
1045  */
1046  proc->wait_event_info = 0;
1047 }
1048 
1049 /* nontransactional event counts are simple enough to inline */
1050 
1051 #define pgstat_count_heap_scan(rel) \
1052  do { \
1053  if ((rel)->pgstat_info != NULL) \
1054  (rel)->pgstat_info->t_counts.t_numscans++; \
1055  } while (0)
1056 #define pgstat_count_heap_getnext(rel) \
1057  do { \
1058  if ((rel)->pgstat_info != NULL) \
1059  (rel)->pgstat_info->t_counts.t_tuples_returned++; \
1060  } while (0)
1061 #define pgstat_count_heap_fetch(rel) \
1062  do { \
1063  if ((rel)->pgstat_info != NULL) \
1064  (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
1065  } while (0)
1066 #define pgstat_count_index_scan(rel) \
1067  do { \
1068  if ((rel)->pgstat_info != NULL) \
1069  (rel)->pgstat_info->t_counts.t_numscans++; \
1070  } while (0)
1071 #define pgstat_count_index_tuples(rel, n) \
1072  do { \
1073  if ((rel)->pgstat_info != NULL) \
1074  (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
1075  } while (0)
1076 #define pgstat_count_buffer_read(rel) \
1077  do { \
1078  if ((rel)->pgstat_info != NULL) \
1079  (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
1080  } while (0)
1081 #define pgstat_count_buffer_hit(rel) \
1082  do { \
1083  if ((rel)->pgstat_info != NULL) \
1084  (rel)->pgstat_info->t_counts.t_blocks_hit++; \
1085  } while (0)
1086 #define pgstat_count_buffer_read_time(n) \
1087  (pgStatBlockReadTime += (n))
1088 #define pgstat_count_buffer_write_time(n) \
1089  (pgStatBlockWriteTime += (n))
1090 
1091 extern void pgstat_count_heap_insert(Relation rel, int n);
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 
1100  bool finalize);
1101 
1102 extern void AtEOXact_PgStat(bool isCommit);
1103 extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth);
1104 
1105 extern void AtPrepare_PgStat(void);
1106 extern void PostPrepare_PgStat(void);
1107 
1108 extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info,
1109  void *recdata, uint32 len);
1110 extern void pgstat_twophase_postabort(TransactionId xid, uint16 info,
1111  void *recdata, uint32 len);
1112 
1113 extern void pgstat_send_archiver(const char *xlog, bool failed);
1114 extern void pgstat_send_bgwriter(void);
1115 
1116 /* ----------
1117  * Support functions for the SQL-callable functions to
1118  * generate the pgstat* views.
1119  * ----------
1120  */
1123 extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
1126 extern int pgstat_fetch_stat_numbackends(void);
1129 
1130 #endif /* PGSTAT_H */
bool ssl_compression
Definition: pgstat.h:742
void pgstat_count_truncate(Relation rel)
Definition: pgstat.c:1897
PgStat_MsgBgWriter msg_bgwriter
Definition: pgstat.h:539
PgStat_Counter m_buf_fsync_backend
Definition: pgstat.h:405
PgStat_ArchiverStats * pgstat_fetch_stat_archiver(void)
Definition: pgstat.c:2443
void pgstat_initialize(void)
Definition: pgstat.c:2628
PgStat_Counter analyze_count
Definition: pgstat.h:627
char ssl_cipher[NAMEDATALEN]
Definition: pgstat.h:744
char last_failed_wal[MAX_XFN_CHARS+1]
Definition: pgstat.h:658
instr_time f_self_time
Definition: pgstat.h:449
char m_xlog[MAX_XFN_CHARS+1]
Definition: pgstat.h:387
int pgstat_start(void)
Definition: pgstat.c:659
PgStat_Counter buf_alloc
Definition: pgstat.h:679
instr_time f_start
Definition: pgstat.h:897
PgStat_Counter archived_count
Definition: pgstat.h:653
void pgstat_ping(void)
Definition: pgstat.c:1461
PgStat_Counter m_buf_written_checkpoints
Definition: pgstat.h:401
PgStat_Counter m_buf_alloc
Definition: pgstat.h:406
struct PgStat_MsgFuncpurge PgStat_MsgFuncpurge
PgStat_Counter t_delta_live_tuples
Definition: pgstat.h:110
Oid st_progress_command_target
Definition: pgstat.h:815
PgStat_Counter m_dead_tuples
Definition: pgstat.h:358
void pgstat_clear_snapshot(void)
Definition: pgstat.c:4811
int64 PgStat_Counter
Definition: pgstat.h:74
PgStat_Counter m_checkpoint_write_time
Definition: pgstat.h:407
TimestampTz m_vacuumtime
Definition: pgstat.h:356
PgStat_Counter tuples_updated
Definition: pgstat.h:168
void pgstat_report_xact_timestamp(TimestampTz tstamp)
Definition: pgstat.c:2988
const char * pgstat_get_backend_current_activity(int pid, bool checkUser)
Definition: pgstat.c:3222
NON_EXEC_STATIC void PgstatCollectorMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: pgstat.c:3468
PgStat_Counter tuples_returned
Definition: pgstat.h:607
PgStat_MsgDeadlock msg_deadlock
Definition: pgstat.h:543
uint32 TransactionId
Definition: c.h:393
PgStat_MsgResetsharedcounter msg_resetsharedcounter
Definition: pgstat.h:533
union PgStat_Msg PgStat_Msg
TimestampTz stats_timestamp
Definition: pgstat.h:586
uint32 wait_event_info
Definition: proc.h:155
void pgstat_progress_update_param(int index, int64 val)
Definition: pgstat.c:2885
TrackFunctionsLevel
Definition: pgstat.h:37
PgStat_Counter t_tuples_fetched
Definition: pgstat.h:102
PgStat_MsgHdr m_hdr
Definition: pgstat.h:429
PgStat_Counter m_live_tuples
Definition: pgstat.h:357
TimestampTz clock_time
Definition: pgstat.h:229
TimestampTz st_activity_start_timestamp
Definition: pgstat.h:783
instr_time save_total
Definition: pgstat.h:895
PgStat_Counter n_blocks_hit
Definition: pgstat.h:567
PGPROC * MyProc
Definition: proc.c:65
#define PGSTAT_NUM_TABPURGE
Definition: pgstat.h:272
struct PgStat_MsgTabpurge PgStat_MsgTabpurge
void pgstat_update_heap_dead_tuples(Relation rel, int delta)
Definition: pgstat.c:1926
PgStat_MsgHdr m_hdr
Definition: pgstat.h:339
struct PgStat_MsgArchiver PgStat_MsgArchiver
PgStat_Counter m_timed_checkpoints
Definition: pgstat.h:399
PgStat_Counter n_conflict_bufferpin
Definition: pgstat.h:577
void pgstat_report_appname(const char *appname)
Definition: pgstat.c:2959
PgStat_Counter m_maxwritten_clean
Definition: pgstat.h:403
PgStat_Counter n_conflict_startup_deadlock
Definition: pgstat.h:578
void CreateSharedBackendStatus(void)
Definition: pgstat.c:2516
PgStat_Counter t_tuples_hot_updated
Definition: pgstat.h:107
void pgstat_progress_start_command(ProgressCommandType cmdtype, Oid relid)
Definition: pgstat.c:2864
PgStat_MsgHdr m_hdr
Definition: pgstat.h:397
TimestampTz autovac_analyze_timestamp
Definition: pgstat.h:628
bool pgstat_track_activities
Definition: pgstat.c:107
struct PgStat_MsgDeadlock PgStat_MsgDeadlock
struct timeval instr_time
Definition: instr_time.h:59
PgStat_Counter f_self_time
Definition: pgstat.h:471
PgStat_Counter timed_checkpoints
Definition: pgstat.h:670
PgStat_MsgHdr m_hdr
Definition: pgstat.h:502
PgStat_Counter n_temp_files
Definition: pgstat.h:579
Oid m_databaseid
Definition: pgstat.h:353
PgStat_Counter m_buf_written_clean
Definition: pgstat.h:402
unsigned char uint8
Definition: c.h:263
PgStat_MsgDummy msg_dummy
Definition: pgstat.h:527
HTAB * functions
Definition: pgstat.h:593
TransactionId backend_xmin
Definition: pgstat.h:881
PgStat_GlobalStats * pgstat_fetch_global(void)
Definition: pgstat.c:2460
char ssl_version[NAMEDATALEN]
Definition: pgstat.h:743
PgStat_Counter n_tuples_returned
Definition: pgstat.h:568
PgStat_Counter vacuum_count
Definition: pgstat.h:623
SockAddr st_clientaddr
Definition: pgstat.h:789
bool m_autovacuum
Definition: pgstat.h:355
void pgstat_send_archiver(const char *xlog, bool failed)
Definition: pgstat.c:3411
size_t m_filesize
Definition: pgstat.h:432
PgStat_Counter buf_fsync_backend
Definition: pgstat.h:678
struct PgStat_TableCounts PgStat_TableCounts
struct PgStat_MsgDummy PgStat_MsgDummy
TimestampTz stats_timestamp
Definition: pgstat.h:669
TimestampTz stat_reset_timestamp
Definition: pgstat.h:585
bool pgstat_track_counts
Definition: pgstat.c:108
instr_time f_total_time
Definition: pgstat.h:448
struct PgStat_TableXactStatus * next
Definition: pgstat.h:179
TimestampTz m_analyzetime
Definition: pgstat.h:373
ProgressCommandType st_progress_command
Definition: pgstat.h:814
void pgstat_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2206
PgStat_Counter numscans
Definition: pgstat.h:605
PgStat_TableCounts t_counts
Definition: pgstat.h:158
#define pg_attribute_noreturn()
Definition: c.h:645
struct PgBackendSSLStatus PgBackendSSLStatus
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:173
PgStat_MsgAnalyze msg_analyze
Definition: pgstat.h:537
PgStat_Counter tuples_hot_updated
Definition: pgstat.h:613
PgStat_Counter f_total_time
Definition: pgstat.h:643
BackendState st_state
Definition: pgstat.h:797
PgStat_Counter t_tuples_returned
Definition: pgstat.h:101
PgStat_Shared_Reset_Target
Definition: pgstat.h:119
char * st_clienthostname
Definition: pgstat.h:790
PgStat_Counter tuples_inserted
Definition: pgstat.h:610
PgStat_FunctionCounts * fs
Definition: pgstat.h:891
PgStat_Counter f_numcalls
Definition: pgstat.h:447
PgStat_MsgHdr msg_hdr
Definition: pgstat.h:526
struct PgStat_StatFuncEntry PgStat_StatFuncEntry
struct PgStat_FunctionCallUsage PgStat_FunctionCallUsage
#define PGDLLIMPORT
Definition: c.h:1043
PgStat_StatTabEntry * pgstat_fetch_stat_tabentry(Oid relid)
Definition: pgstat.c:2298
PgStat_Counter n_xact_commit
Definition: pgstat.h:564
void pgstat_report_deadlock(void)
Definition: pgstat.c:1421
Definition: type.h:90
PgStat_MsgBgWriter BgWriterStats
Definition: pgstat.c:125
Oid st_databaseid
Definition: pgstat.h:787
#define NAMEDATALEN
#define PGSTAT_NUM_PROGRESS_PARAM
Definition: pgstat.h:724
PgStat_Counter n_blocks_fetched
Definition: pgstat.h:566
int pgstat_track_functions
Definition: pgstat.c:109
struct PgStat_TableEntry PgStat_TableEntry
PgStat_Counter n_live_tuples
Definition: pgstat.h:615
PgStat_Counter m_requested_checkpoints
Definition: pgstat.h:400
Definition: dynahash.c:193
double TimestampTz
Definition: timestamp.h:51
struct PgStat_MsgAnalyze PgStat_MsgAnalyze
unsigned short uint16
Definition: c.h:264
PgStat_FunctionCounts f_counts
Definition: pgstat.h:459
PgStat_MsgHdr m_hdr
Definition: pgstat.h:515
PgStat_TableStatus * find_tabstat_entry(Oid rel_id)
Definition: pgstat.c:1723
PgStat_MsgFuncpurge msg_funcpurge
Definition: pgstat.h:541
char * pgstat_stat_tmpname
Definition: pgstat.c:118
PgStat_Counter buf_written_backend
Definition: pgstat.h:677
PgStat_Counter n_conflict_tablespace
Definition: pgstat.h:574
TransactionId backend_xid
Definition: pgstat.h:875
void AtEOSubXact_PgStat(bool isCommit, int nestDepth)
Definition: pgstat.c:2025
TimestampTz vacuum_timestamp
Definition: pgstat.h:622
PgStat_Counter t_tuples_updated
Definition: pgstat.h:105
Oid m_tableid[PGSTAT_NUM_TABPURGE]
Definition: pgstat.h:281
PgStat_MsgHdr m_hdr
Definition: pgstat.h:417
PgStat_Counter pgStatBlockReadTime
Definition: pgstat.c:191
void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type)
Definition: pgstat.c:1279
PgStat_Counter checkpoint_write_time
Definition: pgstat.h:672
PgStat_Counter n_dead_tuples
Definition: pgstat.h:616
struct PgStat_MsgTempFile PgStat_MsgTempFile
LocalPgBackendStatus * pgstat_fetch_stat_local_beentry(int beid)
Definition: pgstat.c:2408
static void pgstat_report_wait_start(uint8 classId, uint16 eventId)
Definition: pgstat.h:1006
void allow_immediate_pgstat_restart(void)
Definition: pgstat.c:722
PgStat_Counter f_numcalls
Definition: pgstat.h:641
TimestampTz last_autovac_time
Definition: pgstat.h:573
struct PgStat_GlobalStats PgStat_GlobalStats
PgStat_Counter n_tuples_inserted
Definition: pgstat.h:570
Oid m_databaseid
Definition: pgstat.h:293
PgStat_Counter buf_written_checkpoints
Definition: pgstat.h:674
PgStat_Counter tuples_inserted
Definition: pgstat.h:167
void AtEOXact_PgStat(bool isCommit)
Definition: pgstat.c:1942
struct PgStat_MsgDropdb PgStat_MsgDropdb
PgStat_Counter pgStatBlockWriteTime
Definition: pgstat.c:192
struct PgStat_MsgInquiry PgStat_MsgInquiry
void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
Definition: pgstat.c:1568
char * pgstat_stat_directory
Definition: pgstat.c:116
void pgstat_report_stat(bool force)
Definition: pgstat.c:743
void pgstat_report_analyze(Relation rel, PgStat_Counter livetuples, PgStat_Counter deadtuples)
Definition: pgstat.c:1350
void pgstat_vacuum_stat(void)
Definition: pgstat.c:942
PgStat_Counter t_delta_dead_tuples
Definition: pgstat.h:111
PgStat_Counter tuples_fetched
Definition: pgstat.h:608
unsigned int uint32
Definition: c.h:265
PgStat_Counter n_conflict_snapshot
Definition: pgstat.h:576
PgStat_MsgHdr m_hdr
Definition: pgstat.h:292
PgStat_Counter m_block_write_time
Definition: pgstat.h:262
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1035
TimestampTz st_state_start_timestamp
Definition: pgstat.h:784
PgStat_Counter n_tuples_deleted
Definition: pgstat.h:572
void pgstat_twophase_postabort(TransactionId xid, uint16 info, void *recdata, uint32 len)
Definition: pgstat.c:2237
PgStat_Counter n_conflict_lock
Definition: pgstat.h:575
char * st_appname
Definition: pgstat.h:800
PgStat_Counter t_blocks_hit
Definition: pgstat.h:115
void pgstat_init(void)
Definition: pgstat.c:316
struct PgStat_TableXactStatus * upper
Definition: pgstat.h:176
PgStat_Counter n_xact_rollback
Definition: pgstat.h:565
int m_xact_rollback
Definition: pgstat.h:260
PgStat_MsgHdr m_hdr
Definition: pgstat.h:304
void pgstat_progress_end_command(void)
Definition: pgstat.c:2936
PgStat_Counter t_tuples_deleted
Definition: pgstat.h:106
PgStat_Counter buf_written_clean
Definition: pgstat.h:675
int pgstat_fetch_stat_numbackends(void)
Definition: pgstat.c:2427
void pgstat_report_recovery_conflict(int reason)
Definition: pgstat.c:1401
PgStat_MsgRecoveryConflict msg_recoveryconflict
Definition: pgstat.h:542
struct PgStat_MsgTabstat PgStat_MsgTabstat
PgBackendStatus * pgstat_fetch_stat_beentry(int beid)
Definition: pgstat.c:2386
PgStat_MsgHdr m_hdr
Definition: pgstat.h:278
PgStat_Counter m_live_tuples
Definition: pgstat.h:374
void pgstat_drop_database(Oid databaseid)
Definition: pgstat.c:1170
const char * pgstat_get_wait_event_type(uint32 wait_event_info)
Definition: pgstat.c:3127
struct PgStat_MsgResetsharedcounter PgStat_MsgResetsharedcounter
struct PgStat_FunctionCounts PgStat_FunctionCounts
const char * pgstat_get_wait_event(uint32 wait_event_info)
Definition: pgstat.c:3168
PgBackendStatus backendStatus
Definition: pgstat.h:869
bool m_autovacuum
Definition: pgstat.h:372
#define PGSTAT_NUM_FUNCENTRIES
Definition: pgstat.h:479
PgStat_Counter tuples_deleted
Definition: pgstat.h:169
struct PgStat_MsgBgWriter PgStat_MsgBgWriter
TimestampTz m_timestamp
Definition: pgstat.h:388
#define PGSTAT_NUM_TABENTRIES
Definition: pgstat.h:250
struct PgStat_MsgResetsinglecounter PgStat_MsgResetsinglecounter
void pgstat_reset_counters(void)
Definition: pgstat.c:1226
#define MAX_XFN_CHARS
Definition: pgarch.h:26
PgStat_Counter f_total_time
Definition: pgstat.h:470
PgStat_MsgAutovacStart msg_autovacuum
Definition: pgstat.h:535
PgStat_Counter blocks_hit
Definition: pgstat.h:620
TimestampTz analyze_timestamp
Definition: pgstat.h:626
TimestampTz last_failed_timestamp
Definition: pgstat.h:660
PgStat_Counter changes_since_analyze
Definition: pgstat.h:617
StatMsgType
Definition: pgstat.h:48
PgStat_Shared_Reset_Target m_resettarget
Definition: pgstat.h:316
void pgstat_report_vacuum(Oid tableoid, bool shared, PgStat_Counter livetuples, PgStat_Counter deadtuples)
Definition: pgstat.c:1325
PgStat_Counter t_numscans
Definition: pgstat.h:99
struct PgStat_MsgVacuum PgStat_MsgVacuum
PgStat_Single_Reset_Type
Definition: pgstat.h:126
Size BackendStatusShmemSize(void)
Definition: pgstat.c:2488
struct PgStat_TableXactStatus PgStat_TableXactStatus
PgStat_Counter n_tuples_updated
Definition: pgstat.h:571
char * pgstat_stat_filename
Definition: pgstat.c:117
PgStat_MsgHdr m_hdr
Definition: pgstat.h:216
PgStat_Counter t_changed_tuples
Definition: pgstat.h:112
PgStat_MsgTabstat msg_tabstat
Definition: pgstat.h:529
PgStat_MsgHdr m_hdr
Definition: pgstat.h:256
void pgstat_send_bgwriter(void)
Definition: pgstat.c:3432
ProgressCommandType
Definition: pgstat.h:718
PgStat_Counter m_checkpoint_sync_time
Definition: pgstat.h:408
PgStat_MsgVacuum msg_vacuum
Definition: pgstat.h:536
char * st_activity
Definition: pgstat.h:803
Definition: regguts.h:313
PgStat_MsgHdr m_hdr
Definition: pgstat.h:485
PgStat_Counter failed_count
Definition: pgstat.h:657
PgStat_StatDBEntry * pgstat_fetch_stat_dbentry(Oid dbid)
Definition: pgstat.c:2271
PgStat_Counter n_block_write_time
Definition: pgstat.h:583
PgStat_Counter m_buf_written_backend
Definition: pgstat.h:404
int64 st_progress_param[PGSTAT_NUM_PROGRESS_PARAM]
Definition: pgstat.h:816
PgStat_MsgHdr m_hdr
Definition: pgstat.h:352
void pgstat_count_heap_delete(Relation rel)
Definition: pgstat.c:1842
PgStat_Counter tuples_deleted
Definition: pgstat.h:612
struct PgStat_StatTabEntry PgStat_StatTabEntry
PgStat_TableCounts t_counts
Definition: pgstat.h:242
PgStat_Counter inserted_pre_trunc
Definition: pgstat.h:171
PgStat_Counter tuples_updated
Definition: pgstat.h:611
size_t Size
Definition: c.h:352
PgStat_Counter checkpoint_sync_time
Definition: pgstat.h:673
void pgstat_report_tempfile(size_t filesize)
Definition: pgstat.c:1440
PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES]
Definition: pgstat.h:488
void pgstat_init_function_usage(FunctionCallInfoData *fcinfo, PgStat_FunctionCallUsage *fcu)
Definition: pgstat.c:1496
struct PgStat_FunctionEntry PgStat_FunctionEntry
TimestampTz autovac_vacuum_timestamp
Definition: pgstat.h:624
PgStat_Counter maxwritten_clean
Definition: pgstat.h:676
PgStat_Counter n_block_read_time
Definition: pgstat.h:582
PgStat_Counter m_block_read_time
Definition: pgstat.h:261
struct PgStat_MsgFuncstat PgStat_MsgFuncstat
TimestampTz stat_reset_timestamp
Definition: pgstat.h:680
void pgstat_bestart(void)
Definition: pgstat.c:2648
struct PgStat_TableXactStatus * trans
Definition: pgstat.h:157
struct PgStat_TableStatus PgStat_TableStatus
struct PgBackendStatus PgBackendStatus
int st_procpid
Definition: pgstat.h:778
struct PgStat_StatDBEntry PgStat_StatDBEntry
PgStat_Counter autovac_analyze_count
Definition: pgstat.h:629
void pgstat_count_heap_insert(Relation rel, int n)
Definition: pgstat.c:1796
void pgstat_report_autovac(Oid dboid)
Definition: pgstat.c:1303
PgStat_Counter updated_pre_trunc
Definition: pgstat.h:172
PgStat_MsgHdr m_hdr
Definition: pgstat.h:369
void pgstat_report_activity(BackendState state, const char *cmd_str)
Definition: pgstat.c:2790
void pgstat_count_heap_update(Relation rel, bool hot)
Definition: pgstat.c:1817
PgStat_BackendFunctionEntry * find_funcstat_entry(Oid func_id)
Definition: pgstat.c:1548
TimestampTz cutoff_time
Definition: pgstat.h:230
TimestampTz stat_reset_timestamp
Definition: pgstat.h:661
TimestampTz last_archived_timestamp
Definition: pgstat.h:656
PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES]
Definition: pgstat.h:263
TimestampTz m_start_time
Definition: pgstat.h:341
PgStat_Counter n_deadlocks
Definition: pgstat.h:581
struct PgStat_MsgAutovacStart PgStat_MsgAutovacStart
TimestampTz st_xact_start_timestamp
Definition: pgstat.h:782
PgStat_MsgArchiver msg_archiver
Definition: pgstat.h:538
int st_changecount
Definition: pgstat.h:775
const char * pgstat_get_crashed_backend_activity(int pid, char *buffer, int buflen)
Definition: pgstat.c:3297
PgStat_MsgResetsinglecounter msg_resetsinglecounter
Definition: pgstat.h:534
PgStat_Counter requested_checkpoints
Definition: pgstat.h:671
StatMsgType m_type
Definition: pgstat.h:195
void pgstat_progress_update_multi_param(int nparam, const int *index, const int64 *val)
Definition: pgstat.c:2907
PgStat_StatFuncEntry * pgstat_fetch_stat_funcentry(Oid funcid)
Definition: pgstat.c:2354
instr_time save_f_total_time
Definition: pgstat.h:893
PgStat_MsgResetcounter msg_resetcounter
Definition: pgstat.h:532
BackendState
Definition: pgstat.h:688
WaitClass
Definition: pgstat.h:704
void pgstat_reset_all(void)
Definition: pgstat.c:617
PgStat_Counter f_numcalls
Definition: pgstat.h:469
struct PgStat_MsgResetcounter PgStat_MsgResetcounter
PgStat_Counter f_self_time
Definition: pgstat.h:644
PgStat_Counter m_dead_tuples
Definition: pgstat.h:375
Definition: proc.h:83
PgStat_Counter blocks_fetched
Definition: pgstat.h:619
void AtPrepare_PgStat(void)
Definition: pgstat.c:2124
struct PgStat_BackendFunctionEntry PgStat_BackendFunctionEntry
struct PgStat_MsgHdr PgStat_MsgHdr
TimestampTz st_proc_start_timestamp
Definition: pgstat.h:781
PgStat_MsgInquiry msg_inquiry
Definition: pgstat.h:528
PgStat_MsgDropdb msg_dropdb
Definition: pgstat.h:531
int m_size
Definition: pgstat.h:196
PgBackendSSLStatus * st_sslstatus
Definition: pgstat.h:794
PgStat_Single_Reset_Type m_resettype
Definition: pgstat.h:328
void pgstat_initstats(Relation rel)
Definition: pgstat.c:1625
PgStat_Counter t_tuples_inserted
Definition: pgstat.h:104
long val
Definition: informix.c:689
void pgstat_reset_shared_counters(const char *)
Definition: pgstat.c:1248
PgStat_MsgTabpurge msg_tabpurge
Definition: pgstat.h:530
#define PGSTAT_NUM_FUNCPURGE
Definition: pgstat.h:496
PGDLLIMPORT int pgstat_track_activity_query_size
Definition: pgstat.c:110
PgStat_TableStatus * parent
Definition: pgstat.h:177
PgStat_Counter t_blocks_fetched
Definition: pgstat.h:114
PgStat_MsgHdr m_hdr
Definition: pgstat.h:385
void PostPrepare_PgStat(void)
Definition: pgstat.c:2173
PgStat_MsgFuncstat msg_funcstat
Definition: pgstat.h:540
struct LocalPgBackendStatus LocalPgBackendStatus
PgStat_Counter n_tuples_fetched
Definition: pgstat.h:569
char last_archived_wal[MAX_XFN_CHARS+1]
Definition: pgstat.h:654
PgStat_Counter autovac_vacuum_count
Definition: pgstat.h:625
Oid m_functionid[PGSTAT_NUM_FUNCPURGE]
Definition: pgstat.h:505
char ssl_clientdn[NAMEDATALEN]
Definition: pgstat.h:745
PgStat_MsgHdr m_hdr
Definition: pgstat.h:228
PgStat_Counter n_temp_bytes
Definition: pgstat.h:580