4 * Definitions for the PostgreSQL statistics collector daemon.
6 * Copyright (c) 2001-2013, PostgreSQL Global Development Group
14 #include "datatype/timestamp.h"
16 #include "libpq/pqcomm.h"
17 #include "portability/instr_time.h"
18 #include "utils/hsearch.h"
19 #include "utils/relcache.h"
22 /* Values for track_functions GUC variable --- order is significant! */
23 typedef enum TrackFunctionsLevel
28 } TrackFunctionsLevel;
31 * The types of backend -> collector messages
34 typedef enum StatMsgType
39 PGSTAT_MTYPE_TABPURGE,
41 PGSTAT_MTYPE_RESETCOUNTER,
42 PGSTAT_MTYPE_RESETSHAREDCOUNTER,
43 PGSTAT_MTYPE_RESETSINGLECOUNTER,
44 PGSTAT_MTYPE_AUTOVAC_START,
47 PGSTAT_MTYPE_BGWRITER,
48 PGSTAT_MTYPE_FUNCSTAT,
49 PGSTAT_MTYPE_FUNCPURGE,
50 PGSTAT_MTYPE_RECOVERYCONFLICT,
51 PGSTAT_MTYPE_TEMPFILE,
56 * The data type used for counters.
59 typedef int64 PgStat_Counter;
62 * PgStat_TableCounts The actual per-table counts kept by a backend
64 * This struct should contain only actual event counters, because we memcmp
65 * it against zeroes to detect whether there are any counts to transmit.
66 * It is a component of PgStat_TableStatus (within-backend state) and
67 * PgStat_TableEntry (the transmitted message format).
69 * Note: for a table, tuples_returned is the number of tuples successfully
70 * fetched by heap_getnext, while tuples_fetched is the number of tuples
71 * successfully fetched by heap_fetch under the control of bitmap indexscans.
72 * For an index, tuples_returned is the number of index entries returned by
73 * the index AM, while tuples_fetched is the number of tuples successfully
74 * fetched by heap_fetch under the control of simple indexscans for this index.
76 * tuples_inserted/updated/deleted/hot_updated count attempted actions,
77 * regardless of whether the transaction committed. delta_live_tuples,
78 * delta_dead_tuples, and changed_tuples are set depending on commit or abort.
79 * Note that delta_live_tuples and delta_dead_tuples can be negative!
82 typedef struct PgStat_TableCounts
84 PgStat_Counter t_numscans;
86 PgStat_Counter t_tuples_returned;
87 PgStat_Counter t_tuples_fetched;
89 PgStat_Counter t_tuples_inserted;
90 PgStat_Counter t_tuples_updated;
91 PgStat_Counter t_tuples_deleted;
92 PgStat_Counter t_tuples_hot_updated;
94 PgStat_Counter t_delta_live_tuples;
95 PgStat_Counter t_delta_dead_tuples;
96 PgStat_Counter t_changed_tuples;
98 PgStat_Counter t_blocks_fetched;
99 PgStat_Counter t_blocks_hit;
100 } PgStat_TableCounts;
102 /* Possible targets for resetting cluster-wide shared values */
103 typedef enum PgStat_Shared_Reset_Target
106 } PgStat_Shared_Reset_Target;
108 /* Possible object types for resetting single counters */
109 typedef enum PgStat_Single_Reset_Type
113 } PgStat_Single_Reset_Type;
115 /* ------------------------------------------------------------
116 * Structures kept in backend local memory while accumulating counts
117 * ------------------------------------------------------------
122 * PgStat_TableStatus Per-table status within a backend
124 * Many of the event counters are nontransactional, ie, we count events
125 * in committed and aborted transactions alike. For these, we just count
126 * directly in the PgStat_TableStatus. However, delta_live_tuples,
127 * delta_dead_tuples, and changed_tuples must be derived from event counts
128 * with awareness of whether the transaction or subtransaction committed or
129 * aborted. Hence, we also keep a stack of per-(sub)transaction status
130 * records for every table modified in the current transaction. At commit
131 * or abort, we propagate tuples_inserted/updated/deleted up to the
132 * parent subtransaction level, or out to the parent PgStat_TableStatus,
136 typedef struct PgStat_TableStatus
138 Oid t_id; /* table's OID */
139 bool t_shared; /* is it a shared catalog? */
140 struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */
141 PgStat_TableCounts t_counts; /* event counts to be sent */
142 } PgStat_TableStatus;
145 * PgStat_TableXactStatus Per-table, per-subtransaction status
148 typedef struct PgStat_TableXactStatus
150 PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
151 PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
152 PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
153 int nest_level; /* subtransaction nest level */
154 /* links to other structs for same relation: */
155 struct PgStat_TableXactStatus *upper; /* next higher subxact if any */
156 PgStat_TableStatus *parent; /* per-table status */
157 /* structs of same subxact level are linked here: */
158 struct PgStat_TableXactStatus *next; /* next of same subxact */
159 } PgStat_TableXactStatus;
162 /* ------------------------------------------------------------
163 * Message formats follow
164 * ------------------------------------------------------------
169 * PgStat_MsgHdr The common message header
172 typedef struct PgStat_MsgHdr
179 * Space available in a message. This will keep the UDP packets below 1K,
180 * which should fit unfragmented into the MTU of the lo interface on most
181 * platforms. Does anybody care for platforms where it doesn't?
184 #define PGSTAT_MSG_PAYLOAD (1000 - sizeof(PgStat_MsgHdr))
188 * PgStat_MsgDummy A dummy message, ignored by the collector
191 typedef struct PgStat_MsgDummy
198 * PgStat_MsgInquiry Sent by a backend to ask the collector
199 * to write the stats file.
203 typedef struct PgStat_MsgInquiry
206 TimestampTz clock_time; /* observed local clock time */
207 TimestampTz cutoff_time; /* minimum acceptable file timestamp */
208 Oid databaseid; /* requested DB (InvalidOid => all DBs) */
213 * PgStat_TableEntry Per-table info in a MsgTabstat
216 typedef struct PgStat_TableEntry
219 PgStat_TableCounts t_counts;
223 * PgStat_MsgTabstat Sent by the backend to report table
224 * and buffer access statistics.
227 #define PGSTAT_NUM_TABENTRIES \
228 ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int)) \
229 / sizeof(PgStat_TableEntry))
231 typedef struct PgStat_MsgTabstat
238 PgStat_Counter m_block_read_time; /* times in microseconds */
239 PgStat_Counter m_block_write_time;
240 PgStat_TableEntry m_entry[PGSTAT_NUM_TABENTRIES];
245 * PgStat_MsgTabpurge Sent by the backend to tell the collector
249 #define PGSTAT_NUM_TABPURGE \
250 ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
253 typedef struct PgStat_MsgTabpurge
258 Oid m_tableid[PGSTAT_NUM_TABPURGE];
259 } PgStat_MsgTabpurge;
263 * PgStat_MsgDropdb Sent by the backend to tell the collector
264 * about a dropped database
267 typedef struct PgStat_MsgDropdb
275 * PgStat_MsgResetcounter Sent by the backend to tell the collector
279 typedef struct PgStat_MsgResetcounter
283 } PgStat_MsgResetcounter;
286 * PgStat_MsgResetsharedcounter Sent by the backend to tell the collector
287 * to reset a shared counter
290 typedef struct PgStat_MsgResetsharedcounter
293 PgStat_Shared_Reset_Target m_resettarget;
294 } PgStat_MsgResetsharedcounter;
297 * PgStat_MsgResetsinglecounter Sent by the backend to tell the collector
298 * to reset a single counter
301 typedef struct PgStat_MsgResetsinglecounter
305 PgStat_Single_Reset_Type m_resettype;
307 } PgStat_MsgResetsinglecounter;
310 * PgStat_MsgAutovacStart Sent by the autovacuum daemon to signal
311 * that a database is going to be processed
314 typedef struct PgStat_MsgAutovacStart
318 TimestampTz m_start_time;
319 } PgStat_MsgAutovacStart;
323 * PgStat_MsgVacuum Sent by the backend or autovacuum daemon
327 typedef struct PgStat_MsgVacuum
333 TimestampTz m_vacuumtime;
334 PgStat_Counter m_tuples;
339 * PgStat_MsgAnalyze Sent by the backend or autovacuum daemon
343 typedef struct PgStat_MsgAnalyze
349 TimestampTz m_analyzetime;
350 PgStat_Counter m_live_tuples;
351 PgStat_Counter m_dead_tuples;
356 * PgStat_MsgBgWriter Sent by the bgwriter to update statistics.
359 typedef struct PgStat_MsgBgWriter
363 PgStat_Counter m_timed_checkpoints;
364 PgStat_Counter m_requested_checkpoints;
365 PgStat_Counter m_buf_written_checkpoints;
366 PgStat_Counter m_buf_written_clean;
367 PgStat_Counter m_maxwritten_clean;
368 PgStat_Counter m_buf_written_backend;
369 PgStat_Counter m_buf_fsync_backend;
370 PgStat_Counter m_buf_alloc;
371 PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */
372 PgStat_Counter m_checkpoint_sync_time;
373 } PgStat_MsgBgWriter;
376 * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict
379 typedef struct PgStat_MsgRecoveryConflict
385 } PgStat_MsgRecoveryConflict;
388 * PgStat_MsgTempFile Sent by the backend upon creating a temp file
391 typedef struct PgStat_MsgTempFile
397 } PgStat_MsgTempFile;
400 * PgStat_FunctionCounts The actual per-function counts kept by a backend
402 * This struct should contain only actual event counters, because we memcmp
403 * it against zeroes to detect whether there are any counts to transmit.
405 * Note that the time counters are in instr_time format here. We convert to
406 * microseconds in PgStat_Counter format when transmitting to the collector.
409 typedef struct PgStat_FunctionCounts
411 PgStat_Counter f_numcalls;
412 instr_time f_total_time;
413 instr_time f_self_time;
414 } PgStat_FunctionCounts;
417 * PgStat_BackendFunctionEntry Entry in backend's per-function hash table
420 typedef struct PgStat_BackendFunctionEntry
423 PgStat_FunctionCounts f_counts;
424 } PgStat_BackendFunctionEntry;
427 * PgStat_FunctionEntry Per-function info in a MsgFuncstat
430 typedef struct PgStat_FunctionEntry
433 PgStat_Counter f_numcalls;
434 PgStat_Counter f_total_time; /* times in microseconds */
435 PgStat_Counter f_self_time;
436 } PgStat_FunctionEntry;
439 * PgStat_MsgFuncstat Sent by the backend to report function
443 #define PGSTAT_NUM_FUNCENTRIES \
444 ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
445 / sizeof(PgStat_FunctionEntry))
447 typedef struct PgStat_MsgFuncstat
452 PgStat_FunctionEntry m_entry[PGSTAT_NUM_FUNCENTRIES];
453 } PgStat_MsgFuncstat;
456 * PgStat_MsgFuncpurge Sent by the backend to tell the collector
457 * about dead functions.
460 #define PGSTAT_NUM_FUNCPURGE \
461 ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
464 typedef struct PgStat_MsgFuncpurge
469 Oid m_functionid[PGSTAT_NUM_FUNCPURGE];
470 } PgStat_MsgFuncpurge;
473 * PgStat_MsgDeadlock Sent by the backend to tell the collector
474 * about a deadlock that occurred.
477 typedef struct PgStat_MsgDeadlock
481 } PgStat_MsgDeadlock;
485 * PgStat_Msg Union over all possible messages.
488 typedef union PgStat_Msg
490 PgStat_MsgHdr msg_hdr;
491 PgStat_MsgDummy msg_dummy;
492 PgStat_MsgInquiry msg_inquiry;
493 PgStat_MsgTabstat msg_tabstat;
494 PgStat_MsgTabpurge msg_tabpurge;
495 PgStat_MsgDropdb msg_dropdb;
496 PgStat_MsgResetcounter msg_resetcounter;
497 PgStat_MsgResetsharedcounter msg_resetsharedcounter;
498 PgStat_MsgResetsinglecounter msg_resetsinglecounter;
499 PgStat_MsgAutovacStart msg_autovacuum;
500 PgStat_MsgVacuum msg_vacuum;
501 PgStat_MsgAnalyze msg_analyze;
502 PgStat_MsgBgWriter msg_bgwriter;
503 PgStat_MsgFuncstat msg_funcstat;
504 PgStat_MsgFuncpurge msg_funcpurge;
505 PgStat_MsgRecoveryConflict msg_recoveryconflict;
506 PgStat_MsgDeadlock msg_deadlock;
510 /* ------------------------------------------------------------
511 * Statistic collector data structures follow
513 * PGSTAT_FILE_FORMAT_ID should be changed whenever any of these
514 * data structures change.
515 * ------------------------------------------------------------
518 #define PGSTAT_FILE_FORMAT_ID 0x01A5BC9B
521 * PgStat_StatDBEntry The collector's data per database
524 typedef struct PgStat_StatDBEntry
527 PgStat_Counter n_xact_commit;
528 PgStat_Counter n_xact_rollback;
529 PgStat_Counter n_blocks_fetched;
530 PgStat_Counter n_blocks_hit;
531 PgStat_Counter n_tuples_returned;
532 PgStat_Counter n_tuples_fetched;
533 PgStat_Counter n_tuples_inserted;
534 PgStat_Counter n_tuples_updated;
535 PgStat_Counter n_tuples_deleted;
536 TimestampTz last_autovac_time;
537 PgStat_Counter n_conflict_tablespace;
538 PgStat_Counter n_conflict_lock;
539 PgStat_Counter n_conflict_snapshot;
540 PgStat_Counter n_conflict_bufferpin;
541 PgStat_Counter n_conflict_startup_deadlock;
542 PgStat_Counter n_temp_files;
543 PgStat_Counter n_temp_bytes;
544 PgStat_Counter n_deadlocks;
545 PgStat_Counter n_block_read_time; /* times in microseconds */
546 PgStat_Counter n_block_write_time;
548 TimestampTz stat_reset_timestamp;
549 TimestampTz stats_timestamp; /* time of db stats file update */
552 * tables and functions must be last in the struct, because we don't write
553 * the pointers out to the stats file.
557 } PgStat_StatDBEntry;
561 * PgStat_StatTabEntry The collector's data per table (or index)
564 typedef struct PgStat_StatTabEntry
568 PgStat_Counter numscans;
570 PgStat_Counter tuples_returned;
571 PgStat_Counter tuples_fetched;
573 PgStat_Counter tuples_inserted;
574 PgStat_Counter tuples_updated;
575 PgStat_Counter tuples_deleted;
576 PgStat_Counter tuples_hot_updated;
578 PgStat_Counter n_live_tuples;
579 PgStat_Counter n_dead_tuples;
580 PgStat_Counter changes_since_analyze;
582 PgStat_Counter blocks_fetched;
583 PgStat_Counter blocks_hit;
585 TimestampTz vacuum_timestamp; /* user initiated vacuum */
586 PgStat_Counter vacuum_count;
587 TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */
588 PgStat_Counter autovac_vacuum_count;
589 TimestampTz analyze_timestamp; /* user initiated */
590 PgStat_Counter analyze_count;
591 TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */
592 PgStat_Counter autovac_analyze_count;
593 } PgStat_StatTabEntry;
597 * PgStat_StatFuncEntry The collector's data per function
600 typedef struct PgStat_StatFuncEntry
604 PgStat_Counter f_numcalls;
606 PgStat_Counter f_total_time; /* times in microseconds */
607 PgStat_Counter f_self_time;
608 } PgStat_StatFuncEntry;
612 * Global statistics kept in the stats collector
614 typedef struct PgStat_GlobalStats
616 TimestampTz stats_timestamp; /* time of stats file update */
617 PgStat_Counter timed_checkpoints;
618 PgStat_Counter requested_checkpoints;
619 PgStat_Counter checkpoint_write_time; /* times in milliseconds */
620 PgStat_Counter checkpoint_sync_time;
621 PgStat_Counter buf_written_checkpoints;
622 PgStat_Counter buf_written_clean;
623 PgStat_Counter maxwritten_clean;
624 PgStat_Counter buf_written_backend;
625 PgStat_Counter buf_fsync_backend;
626 PgStat_Counter buf_alloc;
627 TimestampTz stat_reset_timestamp;
628 } PgStat_GlobalStats;
635 typedef enum BackendState
640 STATE_IDLEINTRANSACTION,
642 STATE_IDLEINTRANSACTION_ABORTED,
647 * Shared-memory data structures
655 * Each live backend maintains a PgBackendStatus struct in shared memory
656 * showing its current activity. (The structs are allocated according to
657 * BackendId, but that is not critical.) Note that the collector process
658 * has no involvement in, or even access to, these structs.
661 typedef struct PgBackendStatus
664 * To avoid locking overhead, we use the following protocol: a backend
665 * increments st_changecount before modifying its entry, and again after
666 * finishing a modification. A would-be reader should note the value of
667 * st_changecount, copy the entry into private memory, then check
668 * st_changecount again. If the value hasn't changed, and if it's even,
669 * the copy is valid; otherwise start over. This makes updates cheap
670 * while reads are potentially expensive, but that's the tradeoff we want.
674 /* The entry is valid iff st_procpid > 0, unused if st_procpid == 0 */
677 /* Times when current backend, transaction, and activity started */
678 TimestampTz st_proc_start_timestamp;
679 TimestampTz st_xact_start_timestamp;
680 TimestampTz st_activity_start_timestamp;
681 TimestampTz st_state_start_timestamp;
683 /* Database OID, owning user's OID, connection client address */
686 SockAddr st_clientaddr;
687 char *st_clienthostname; /* MUST be null-terminated */
689 /* Is backend currently waiting on an lmgr lock? */
693 BackendState st_state;
695 /* application name; MUST be null-terminated */
698 /* current command string; MUST be null-terminated */
703 * Working state needed to accumulate per-function-call timing statistics.
705 typedef struct PgStat_FunctionCallUsage
707 /* Link to function's hashtable entry (must still be there at exit!) */
708 /* NULL means we are not tracking the current function call */
709 PgStat_FunctionCounts *fs;
710 /* Total time previously charged to function, as of function start */
711 instr_time save_f_total_time;
712 /* Backend-wide total time as of function start */
713 instr_time save_total;
714 /* system clock as of function start */
716 } PgStat_FunctionCallUsage;
723 extern bool pgstat_track_activities;
724 extern bool pgstat_track_counts;
725 extern int pgstat_track_functions;
726 extern PGDLLIMPORT int pgstat_track_activity_query_size;
727 extern char *pgstat_stat_directory;
728 extern char *pgstat_stat_tmpname;
729 extern char *pgstat_stat_filename;
732 * BgWriter statistics counters are updated directly by bgwriter and bufmgr
734 extern PgStat_MsgBgWriter BgWriterStats;
737 * Updated by pgstat_count_buffer_*_time macros
739 extern PgStat_Counter pgStatBlockReadTime;
740 extern PgStat_Counter pgStatBlockWriteTime;
743 * Functions called from postmaster
746 extern Size BackendStatusShmemSize(void);
747 extern void CreateSharedBackendStatus(void);
749 extern void pgstat_init(void);
750 extern int pgstat_start(void);
751 extern void pgstat_reset_all(void);
752 extern void allow_immediate_pgstat_restart(void);
755 extern void PgstatCollectorMain(int argc, char *argv[]) __attribute__((noreturn));
760 * Functions called from backends
763 extern void pgstat_ping(void);
765 extern void pgstat_report_stat(bool force);
766 extern void pgstat_vacuum_stat(void);
767 extern void pgstat_drop_database(Oid databaseid);
769 extern void pgstat_clear_snapshot(void);
770 extern void pgstat_reset_counters(void);
771 extern void pgstat_reset_shared_counters(const char *);
772 extern void pgstat_reset_single_counter(Oid objectid, PgStat_Single_Reset_Type type);
774 extern void pgstat_report_autovac(Oid dboid);
775 extern void pgstat_report_vacuum(Oid tableoid, bool shared,
776 PgStat_Counter tuples);
777 extern void pgstat_report_analyze(Relation rel,
778 PgStat_Counter livetuples, PgStat_Counter deadtuples);
780 extern void pgstat_report_recovery_conflict(int reason);
781 extern void pgstat_report_deadlock(void);
783 extern void pgstat_initialize(void);
784 extern void pgstat_bestart(void);
786 extern void pgstat_report_activity(BackendState state, const char *cmd_str);
787 extern void pgstat_report_tempfile(size_t filesize);
788 extern void pgstat_report_appname(const char *appname);
789 extern void pgstat_report_xact_timestamp(TimestampTz tstamp);
790 extern void pgstat_report_waiting(bool waiting);
791 extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser);
792 extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer,
795 extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
796 extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id);
798 extern void pgstat_initstats(Relation rel);
800 /* nontransactional event counts are simple enough to inline */
802 #define pgstat_count_heap_scan(rel) \
804 if ((rel)->pgstat_info != NULL) \
805 (rel)->pgstat_info->t_counts.t_numscans++; \
807 #define pgstat_count_heap_getnext(rel) \
809 if ((rel)->pgstat_info != NULL) \
810 (rel)->pgstat_info->t_counts.t_tuples_returned++; \
812 #define pgstat_count_heap_fetch(rel) \
814 if ((rel)->pgstat_info != NULL) \
815 (rel)->pgstat_info->t_counts.t_tuples_fetched++; \
817 #define pgstat_count_index_scan(rel) \
819 if ((rel)->pgstat_info != NULL) \
820 (rel)->pgstat_info->t_counts.t_numscans++; \
822 #define pgstat_count_index_tuples(rel, n) \
824 if ((rel)->pgstat_info != NULL) \
825 (rel)->pgstat_info->t_counts.t_tuples_returned += (n); \
827 #define pgstat_count_buffer_read(rel) \
829 if ((rel)->pgstat_info != NULL) \
830 (rel)->pgstat_info->t_counts.t_blocks_fetched++; \
832 #define pgstat_count_buffer_hit(rel) \
834 if ((rel)->pgstat_info != NULL) \
835 (rel)->pgstat_info->t_counts.t_blocks_hit++; \
837 #define pgstat_count_buffer_read_time(n) \
838 (pgStatBlockReadTime += (n))
839 #define pgstat_count_buffer_write_time(n) \
840 (pgStatBlockWriteTime += (n))
842 extern void pgstat_count_heap_insert(Relation rel, int n);
843 extern void pgstat_count_heap_update(Relation rel, bool hot);
844 extern void pgstat_count_heap_delete(Relation rel);
845 extern void pgstat_update_heap_dead_tuples(Relation rel, int delta);
847 extern void pgstat_init_function_usage(FunctionCallInfoData *fcinfo,
848 PgStat_FunctionCallUsage *fcu);
849 extern void pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu,
852 extern void AtEOXact_PgStat(bool isCommit);
853 extern void AtEOSubXact_PgStat(bool isCommit, int nestDepth);
855 extern void AtPrepare_PgStat(void);
856 extern void PostPrepare_PgStat(void);
858 extern void pgstat_twophase_postcommit(TransactionId xid, uint16 info,
859 void *recdata, uint32 len);
860 extern void pgstat_twophase_postabort(TransactionId xid, uint16 info,
861 void *recdata, uint32 len);
863 extern void pgstat_send_bgwriter(void);
866 * Support functions for the SQL-callable functions to
867 * generate the pgstat* views.
870 extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid);
871 extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
872 extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
873 extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid);
874 extern int pgstat_fetch_stat_numbackends(void);
875 extern PgStat_GlobalStats *pgstat_fetch_global(void);
877 #endif /* PGSTAT_H */