File: pg.h

package info (click to toggle)
ptop 3.6.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,356 kB
  • ctags: 2,292
  • sloc: ansic: 18,216; sh: 3,493; makefile: 122; awk: 44
file content (42 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*	Copyright (c) 2007, Mark Wong */

#ifndef _PG_H_
#define _PG_H_

#include <libpq-fe.h>

#define SELECT_INDEX_STATS \
		"SELECT indexrelid, indexrelname, idx_scan, idx_tup_read,\n" \
		"       idx_tup_fetch\n" \
		"FROM pg_stat_user_indexes\n" \
		"ORDER BY indexrelname"

#define SELECT_TABLE_STATS \
		"SELECT relid, relname, seq_scan, seq_tup_read, idx_scan,\n" \
		"       idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del\n" \
		"FROM pg_stat_user_tables\n" \
		"ORDER BY relname"

/* Table statistics comparison functions for qsort. */
int			compare_idx_scan_t(const void *, const void *);
int			compare_idx_tup_fetch_t(const void *, const void *);
int			compare_n_tup_del(const void *, const void *);
int			compare_n_tup_ins(const void *, const void *);
int			compare_n_tup_upd(const void *, const void *);
int			compare_seq_scan(const void *, const void *);
int			compare_seq_tup_read(const void *, const void *);

/* Index statistics comparison functions for qsort. */
int			compare_idx_scan(const void *, const void *);
int			compare_idx_tup_fetch(const void *, const void *);
int			compare_idx_tup_read(const void *, const void *);

PGconn	   *connect_to_db(char *);

void		pg_display_index_stats(char *, int, int);
void		pg_display_table_stats(char *, int, int);

extern char *index_ordernames[];
extern char *table_ordernames[];

#endif   /* _PG_H_ */