summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <mark@2ndQuadrant.com>2019-06-05 02:58:40 +0000
committerMark Wong <mark@2ndQuadrant.com>2019-06-26 12:39:53 -0700
commit3daa6e592e70c046eb7a85000b71ce5aab40b703 (patch)
tree49c3f2e634e3b4bec2987528793c702103b0525a
parentf595ce3bb62130c5aa4f8465677ab028e0428edf (diff)
Remove table stats view
Simplify the pg_top code by moving this functionality to pgstat.
-rw-r--r--FAQ1
-rw-r--r--HISTORY1
-rw-r--r--README1
-rw-r--r--commands.c41
-rw-r--r--commands.h1
-rw-r--r--help.h3
-rw-r--r--machine.h1
-rw-r--r--pg.c536
-rw-r--r--pg.h17
-rw-r--r--pg_top.1.in8
-rw-r--r--pg_top.c5
-rw-r--r--pg_top.h1
12 files changed, 2 insertions, 614 deletions
diff --git a/FAQ b/FAQ
index c9093a7..43cde2a 100644
--- a/FAQ
+++ b/FAQ
@@ -16,7 +16,6 @@
* View currently running SQL statement of a process.
* View query plan of a currently running SELECT statement.
* View locks held by a process.
- * View user table statistics.
* View user index statistics.
2. Where do I get the latest version of pg_top?
diff --git a/HISTORY b/HISTORY
index 0c8cdb3..65ee3f5 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,6 +4,7 @@ Release 4.0.0
* Replace autoconf with cmake
* Add monitoring of pg_stat_statements
+ * Remove table stats monitoring, use pgstat instead
Release 3.7.0
diff --git a/README b/README
index 0279b81..02894a7 100644
--- a/README
+++ b/README
@@ -11,7 +11,6 @@ pg_top allows you to monitor PostgreSQL processes. It also allows you to:
* View currently running SQL statement of a process.
* View query plan of a currently running SELECT statement.
* View locks held by a process.
- * View user table statistics.
* View user index statistics.
CAVEAT: version 3 of pg_top has internal commands that kill and renice
diff --git a/commands.c b/commands.c
index 600bfe3..ea2f89d 100644
--- a/commands.c
+++ b/commands.c
@@ -74,8 +74,6 @@ char header_index_stats[43] = " I_SCANS I_READS I_FETCHES INDEXRELNAME";
char header_io_stats[64] =
" PID RCHAR WCHAR SYSCR SYSCW READS WRITES CWRITES COMMAND";
char header_statements[46] = " CALLS CALLS% TOTAL_TIME AVG_TIME QUERY";
-char header_table_stats[78] =
- "SEQ_SCANS SEQ_READS I_SCANS I_FETCHES INSERTS UPDATES DELETES RELNAME";
/* These macros get used to reset and log the errors */
#define ERR_RESET errcnt = 0
@@ -122,7 +120,6 @@ struct cmd cmd_map[] = {
#ifdef ENABLE_KILL
{'r', cmd_renice},
#endif /* ENABLE_KILL */
- {'R', cmd_tables},
{'s', cmd_delay},
{'S', cmd_statements},
{'t', cmd_toggle},
@@ -470,27 +467,6 @@ cmd_order(struct pg_top_context *pgtctx)
clear_message();
}
break;
- case MODE_TABLE_STATS:
- new_message(MT_standout, "Order to sort: ");
- if (readline(tempbuf, sizeof(tempbuf), No) > 0)
- {
- if ((i = string_index(tempbuf, table_ordernames)) == -1)
- {
- new_message(MT_standout, " %s: unrecognized sorting order",
- tempbuf);
- no_command = Yes;
- }
- else
- {
- pgtctx->table_order_index = i;
- }
- putchar('\r');
- }
- else
- {
- clear_message();
- }
- break;
case MODE_IO_STATS:
new_message(MT_standout, "Order to sort: ");
if (readline(tempbuf, sizeof(tempbuf), No) > 0)
@@ -697,23 +673,6 @@ cmd_statements(struct pg_top_context *pgtctx)
}
int
-cmd_tables(struct pg_top_context *pgtctx)
-{
- if (pgtctx->mode == MODE_TABLE_STATS)
- {
- pgtctx->mode = MODE_PROCESSES;
- pgtctx->header_text = pgtctx->header_processes;
- }
- else
- {
- pgtctx->mode = MODE_TABLE_STATS;
- pgtctx->header_text = header_table_stats;
- }
- reset_display(pgtctx);
- return No;
-}
-
-int
cmd_toggle(struct pg_top_context *pgtctx)
{
if (mode_stats == STATS_DIFF)
diff --git a/commands.h b/commands.h
index ea5aed2..d851950 100644
--- a/commands.h
+++ b/commands.h
@@ -47,7 +47,6 @@ int cmd_redraw(struct pg_top_context *);
int cmd_renice(struct pg_top_context *);
#endif /* ENABLE_KILL */
int cmd_statements(struct pg_top_context *);
-int cmd_tables(struct pg_top_context *);
int cmd_toggle(struct pg_top_context *);
int cmd_update(struct pg_top_context *);
int cmd_user(struct pg_top_context *);
diff --git a/help.h b/help.h
index f909693..2a23952 100644
--- a/help.h
+++ b/help.h
@@ -18,7 +18,6 @@ L - show locks held by a process\n\
M - sort by memory usage\n\
N - sort by pid\n\
P - sort by CPU usage\n\
-R - show user table statistics\n\
S - show pg_stat_statements statistics\n\
Q - show current query of a process\n\
T - sort by time\n\
@@ -33,8 +32,6 @@ k - kill processes; send a signal to a list of processes\n\
n or # - change number of processes to display\n\
o - specify sort order (%s)\n\
index stats (idx_scan, idx_tup_fetch, idx_tup_read)\n\
- table stats (seq_scan, seq_tup_read, idx_scan, idx_tup_fetch,\n\
- n_tup_ins, n_tup_upd, n_tup_del)\n\
i/o stats (%s)\n\
q - quit\n\
r - renice a process\n\
diff --git a/machine.h b/machine.h
index b3fa1c5..4a050cb 100644
--- a/machine.h
+++ b/machine.h
@@ -29,7 +29,6 @@
/* Display modes. */
#define MODE_PROCESSES 0
-#define MODE_TABLE_STATS 1
#define MODE_INDEX_STATS 2
#define MODE_IO_STATS 3
#define MODE_STATEMENTS 4
diff --git a/pg.c b/pg.c
index 1bbdf67..fb5bdc8 100644
--- a/pg.c
+++ b/pg.c
@@ -50,11 +50,6 @@ char *statement_ordernames[] = {
"calls", "calls%", "total_time", "avg_time", NULL
};
-char *table_ordernames[] = {
- "seq_scan", "seq_tup_read", "idx_scan", "idx_tup_fetch", "n_tup_ins",
- "n_tup_upd", "n_tup_del", NULL
-};
-
int (*index_compares[]) () =
{
compare_idx_scan,
@@ -63,18 +58,6 @@ int (*index_compares[]) () =
NULL
};
-int (*table_compares[]) () =
-{
- compare_seq_scan,
- compare_seq_tup_read,
- compare_idx_scan_t,
- compare_idx_tup_fetch_t,
- compare_n_tup_ins,
- compare_n_tup_upd,
- compare_n_tup_del,
- NULL
-};
-
struct index_node
{
long long indexrelid;
@@ -100,43 +83,6 @@ struct index_node
struct index_node *next;
};
-struct table_node
-{
- long long relid;
-
- /* Index to the relation name in the PGresult object. */
- int name_index;
-
- /* The change in the previous values and current values. */
- long long diff_idx_scan;
- long long diff_idx_tup_fetch;
- long long diff_n_tup_del;
- long long diff_n_tup_ins;
- long long diff_n_tup_upd;
- long long diff_seq_scan;
- long long diff_seq_tup_read;
-
- /* The previous values. */
- long long old_idx_scan;
- long long old_idx_tup_fetch;
- long long old_n_tup_del;
- long long old_n_tup_ins;
- long long old_n_tup_upd;
- long long old_seq_scan;
- long long old_seq_tup_read;
-
- /* The value totals. */
- long long total_idx_scan;
- long long total_idx_tup_fetch;
- long long total_n_tup_del;
- long long total_n_tup_ins;
- long long total_n_tup_upd;
- long long total_seq_scan;
- long long total_seq_tup_read;
-
- struct table_node *next;
-};
-
struct index_node *get_index_stats(struct index_node *, long long);
struct index_node *insert_index_stats(struct index_node *, struct index_node *);
struct index_node *new_index_node(long long);
@@ -144,14 +90,6 @@ void update_index_stats(struct index_node *, long long, long long, long long);
struct index_node *upsert_index_stats(struct index_node *, long long,
long long, long long, long long);
-struct table_node *get_table_stats(struct table_node *, long long);
-struct table_node *insert_table_stats(struct table_node *, struct table_node *);
-struct table_node *new_table_node(long long);
-void update_table_stats(struct table_node *, long long, long long, long long,
- long long, long long, long long, long long);
-struct table_node *upsert_table_stats(struct table_node *, long long,
- long long, long long, long long, long long, long long, long long,
- long long);
float pg_version(PGconn *);
int
@@ -189,40 +127,6 @@ compare_idx_scan(const void *vp1, const void *vp2)
}
int
-compare_idx_scan_t(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_idx_scan < p2->diff_idx_scan)
- {
- return -1;
- }
- else if (p1->diff_idx_scan > p2->diff_idx_scan)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_idx_scan < p2->total_idx_scan)
- {
- return -1;
- }
- else if (p1->total_idx_scan > p2->total_idx_scan)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
compare_idx_tup_fetch(const void *vp1, const void *vp2)
{
struct index_node **pp1 = (struct index_node **) vp1;
@@ -257,40 +161,6 @@ compare_idx_tup_fetch(const void *vp1, const void *vp2)
}
int
-compare_idx_tup_fetch_t(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_idx_tup_fetch < p2->diff_idx_tup_fetch)
- {
- return -1;
- }
- else if (p1->diff_idx_tup_fetch > p2->diff_idx_tup_fetch)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_idx_tup_fetch < p2->total_idx_tup_fetch)
- {
- return -1;
- }
- else if (p1->total_idx_tup_fetch > p2->total_idx_tup_fetch)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
compare_idx_tup_read(const void *vp1, const void *vp2)
{
struct index_node **pp1 = (struct index_node **) vp1;
@@ -324,176 +194,6 @@ compare_idx_tup_read(const void *vp1, const void *vp2)
}
}
-int
-compare_n_tup_del(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_n_tup_del < p2->diff_n_tup_del)
- {
- return -1;
- }
- else if (p1->diff_n_tup_del > p2->diff_n_tup_del)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_n_tup_del < p2->total_n_tup_del)
- {
- return -1;
- }
- else if (p1->total_n_tup_del > p2->total_n_tup_del)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
-compare_n_tup_ins(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_n_tup_ins < p2->diff_n_tup_ins)
- {
- return -1;
- }
- else if (p1->diff_n_tup_ins > p2->diff_n_tup_ins)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_n_tup_ins < p2->total_n_tup_ins)
- {
- return -1;
- }
- else if (p1->total_n_tup_ins > p2->total_n_tup_ins)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
-compare_n_tup_upd(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_n_tup_upd < p2->diff_n_tup_upd)
- {
- return -1;
- }
- else if (p1->diff_n_tup_upd > p2->diff_n_tup_upd)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_n_tup_upd < p2->total_n_tup_upd)
- {
- return -1;
- }
- else if (p1->total_n_tup_upd > p2->total_n_tup_upd)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
-compare_seq_scan(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_seq_scan < p2->diff_seq_scan)
- {
- return -1;
- }
- else if (p1->diff_seq_scan > p2->diff_seq_scan)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_seq_scan < p2->total_seq_scan)
- {
- return -1;
- }
- else if (p1->total_seq_scan > p2->total_seq_scan)
- {
- return 1;
- }
- return 0;
- }
-}
-
-int
-compare_seq_tup_read(const void *vp1, const void *vp2)
-{
- struct table_node **pp1 = (struct table_node **) vp1;
- struct table_node **pp2 = (struct table_node **) vp2;
- struct table_node *p1 = *pp1;
- struct table_node *p2 = *pp2;
-
- if (mode_stats == STATS_DIFF)
- {
- if (p1->diff_seq_tup_read < p2->diff_seq_tup_read)
- {
- return -1;
- }
- else if (p1->diff_seq_tup_read > p2->diff_seq_tup_read)
- {
- return 1;
- }
- return 0;
- }
- else
- {
- if (p1->total_seq_tup_read < p2->total_seq_tup_read)
- {
- return -1;
- }
- else if (p1->total_seq_tup_read > p2->total_seq_tup_read)
- {
- return 1;
- }
- return 0;
- }
-}
-
PGconn *
connect_to_db(const char *values[])
{
@@ -529,22 +229,6 @@ get_index_stats(struct index_node * head,
return c;
}
-struct table_node *
-get_table_stats(struct table_node * head, long long relid)
-{
- struct table_node *c = head;
-
- while (c != NULL)
- {
- if (c->relid == relid)
- {
- break;
- }
- c = c->next;
- }
- return c;
-}
-
void
pg_display_index_stats(const char *values[6], int compare_index, int max_topn)
{
@@ -620,94 +304,6 @@ pg_display_index_stats(const char *values[6], int compare_index, int max_topn)
PQclear(pgresult);
}
-void
-pg_display_table_stats(const char *values[], int compare_index, int max_topn)
-{
- int i;
- int rows;
- PGconn *pgconn;
- PGresult *pgresult = NULL;
- static char line[512];
-
- static struct table_node *head = NULL;
- static struct table_node **procs = NULL;
-
- int max_lines;
-
- pgconn = connect_to_db(values);
- if (pgconn != NULL)
- {
- pgresult = PQexec(pgconn, SELECT_TABLE_STATS);
- rows = PQntuples(pgresult);
- }
- else
- {
- PQfinish(pgconn);
- return;
- }
- PQfinish(pgconn);
-
- max_lines = rows < max_topn ? rows : max_topn;
-
- procs = (struct table_node **) realloc(procs,
- rows * sizeof(struct table_node *));
- /* Calculate change in values. */
- for (i = 0; i < rows; i++)
- {
- head = upsert_table_stats(head,
- atoll(PQgetvalue(pgresult, i, 0)),
- atoll(PQgetvalue(pgresult, i, 2)),
- atoll(PQgetvalue(pgresult, i, 3)),
- atoll(PQgetvalue(pgresult, i, 4)),
- atoll(PQgetvalue(pgresult, i, 5)),
- atoll(PQgetvalue(pgresult, i, 6)),
- atoll(PQgetvalue(pgresult, i, 7)),
- atoll(PQgetvalue(pgresult, i, 8)));
- }
-
- /* Sort stats. */
- for (i = 0; i < rows; i++)
- {
- procs[i] = get_table_stats(head, atoll(PQgetvalue(pgresult, i, 0)));
- procs[i]->name_index = i;
- }
- qsort(procs, rows, sizeof(struct table_node *),
- table_compares[compare_index]);
-
- for (i = rows - 1; i > rows - max_lines - 1; i--)
- {
- if (mode_stats == STATS_DIFF) {
- snprintf(line, sizeof(line),
- "%9lld %9lld %9lld %9lld %9lld %9lld %9lld %s",
- procs[i]->diff_seq_scan,
- procs[i]->diff_seq_tup_read,
- procs[i]->diff_idx_scan,
- procs[i]->diff_idx_tup_fetch,
- procs[i]->diff_n_tup_ins,
- procs[i]->diff_n_tup_upd,
- procs[i]->diff_n_tup_del,
- PQgetvalue(pgresult, procs[i]->name_index, 1));
- }
- else
- {
- snprintf(line, sizeof(line),
- "%9lld %9lld %9lld %9lld %9lld %9lld %9lld %s",
- procs[i]->total_seq_scan,
- procs[i]->total_seq_tup_read,
- procs[i]->total_idx_scan,
- procs[i]->total_idx_tup_fetch,
- procs[i]->total_n_tup_ins,
- procs[i]->total_n_tup_upd,
- procs[i]->total_n_tup_del,
- PQgetvalue(pgresult, procs[i]->name_index, 1));
- }
- u_process(rows - i - 1, line);
- }
-
- if (pgresult != NULL)
- PQclear(pgresult);
-}
-
int
pg_display_statements(const char *values[], int compare_index, int max_topn)
{
@@ -879,47 +475,6 @@ insert_index_stats(struct index_node * head,
return head;
}
-struct table_node *
-insert_table_stats(struct table_node * head,
- struct table_node * node)
-{
- struct table_node *c = head;
- struct table_node *p = NULL;
-
- /* Check the head of the list as a special case. */
- if (node->relid < head->relid)
- {
- node->next = head;
- head = node;
- return head;
- }
-
- c = head->next;
- p = head;
- while (c != NULL)
- {
- if (node->relid < c->relid)
- {
- node->next = c;
-
- p->next = node;
-
- return head;
- }
- p = c;
- c = c->next;
- }
-
- /*
- * The node to be inserted has the highest relid so it goes on the end.
- */
- if (c == NULL)
- {
- p->next = node;
- }
- return head;
-}
-
struct index_node *
new_index_node(long long indexrelid)
{
@@ -933,19 +488,6 @@ new_index_node(long long indexrelid)
return node;
}
-struct table_node *
-new_table_node(long long relid)
-{
- struct table_node *node;
-
- node = (struct table_node *) malloc(sizeof(struct table_node));
- bzero(node, sizeof(struct table_node));
- node->relid = relid;
- node->next = NULL;
-
- return node;
-}
-
void
update_index_stats(struct index_node * node, long long idx_scan,
long long idx_tup_read, long long idx_tup_fetch)
@@ -966,39 +508,6 @@ update_index_stats(struct index_node * node, long long idx_scan,
node->old_idx_tup_fetch = idx_tup_fetch;
}
-void
-update_table_stats(struct table_node * node, long long seq_scan,
- long long seq_tup_read, long long idx_scan, long long idx_tup_fetch,
- long long n_tup_ins, long long n_tup_upd, long long n_tup_del)
-{
- /* Add to the table totals */
- node->total_idx_scan = idx_scan;
- node->total_idx_tup_fetch = idx_tup_fetch;
- node->total_n_tup_del = n_tup_del;
- node->total_n_tup_ins = n_tup_ins;
- node->total_n_tup_upd = n_tup_upd;
- node->total_seq_scan = seq_scan;
- node->total_seq_tup_read = seq_tup_read;
-
- /* Calculate difference between previous and current values. */
- node->diff_idx_scan = idx_scan - node->old_idx_scan;
- node->diff_idx_tup_fetch = idx_tup_fetch - node->old_idx_tup_fetch;
- node->diff_n_tup_del = n_tup_del - node->old_n_tup_del;
- node->diff_n_tup_ins = n_tup_ins - node->old_n_tup_ins;
- node->diff_n_tup_upd = n_tup_upd - node->old_n_tup_upd;
- node->diff_seq_scan = seq_scan - node->old_seq_scan;
- node->diff_seq_tup_read = seq_tup_read - node->old_seq_tup_read;
-
- /* Save the current values as previous values. */
- node->old_idx_scan = idx_scan;
- node->old_idx_tup_fetch = idx_tup_fetch;
- node->old_n_tup_del = n_tup_del;
- node->old_n_tup_ins = n_tup_ins;
- node->old_n_tup_upd = n_tup_upd;
- node->old_seq_scan = seq_scan;
- node->old_seq_tup_read = seq_tup_read;
-}
-
/*
* Determine if indexrelid exists in the list and update it if it does.
* Otherwise Create a new node and insert it into the list. Sort this
@@ -1040,48 +549,3 @@ upsert_index_stats(struct index_node * head,
head = insert_index_stats(head, c);
return head;
}
-
-/*
- * Determine if relid exists in the list and update it if it does.
- * Otherwise Create a new node and insert it into the list. Sort this
- * list by relid.
- */
-struct table_node *
-upsert_table_stats(struct table_node * head,
- long long relid, long long seq_scan, long long seq_tup_read,
- long long idx_scan, long long idx_tup_fetch, long long n_tup_ins,
- long long n_tup_upd, long long n_tup_del)
-{
- struct table_node *c = head;
-
- /* List is empty, create a new node. */
- if (head == NULL)
- {
- head = new_table_node(relid);
- update_table_stats(head, seq_scan, seq_tup_read, idx_scan,
- idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del);
- return head;
- }
-
- /* Check if this relid exists already. */
- while (c != NULL)
- {
- if (c->relid == relid)
- {
- /* Found an existing node with same relid, update it. */
- update_table_stats(c, seq_scan, seq_tup_read, idx_scan,
- idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del);
- return head;
- }
- c = c->next;
- }
-
- /*
- * Didn't find relid. Create a new node, save the data and insert it.
- */
- c = new_table_node(relid);
- update_table_stats(c, seq_scan, seq_tup_read, idx_scan, idx_tup_fetch,
- n_tup_ins, n_tup_upd, n_tup_del);
- head = insert_table_stats(head, c);
- return head;
-}
diff --git a/pg.h b/pg.h
index 69aed96..17a545a 100644
--- a/pg.h
+++ b/pg.h
@@ -16,12 +16,6 @@
"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"
-
#define SELECT_STATEMENTS \
"WITH aggs AS (\n" \
" SELECT sum(calls) AS calls_total\n" \
@@ -37,15 +31,6 @@
"FROM pg_stat_statements, aggs\n" \
"ORDER BY %d ASC"
-/* 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 *);
@@ -54,7 +39,6 @@ int compare_idx_tup_read(const void *, const void *);
PGconn *connect_to_db(const char **);
void pg_display_index_stats(const char **, int, int);
-void pg_display_table_stats(const char **, int, int);
int pg_display_statements(const char **, int, int);
PGresult *pg_locks(PGconn *, int);
@@ -63,6 +47,5 @@ PGresult *pg_query(PGconn *, int);
extern char *index_ordernames[];
extern char *statement_ordernames[];
-extern char *table_ordernames[];
#endif /* _PG_H_ */
diff --git a/pg_top.1.in b/pg_top.1.in
index d0f2818..3ca8ab3 100644
--- a/pg_top.1.in
+++ b/pg_top.1.in
@@ -272,10 +272,7 @@ Change the number of processes to display (prompt for new number).
Change the order in which the display is sorted. This command is not
available on all systems. The sort key names when viewing processes vary
fron system to system but usually include: \*(lqcpu\*(rq, \*(lqres\*(rq,
-\*(lqsize\*(rq, \*(lqtime\*(rq. The default is cpu. When viewing user
-table statistics: \*(lqseq_scan\*(rq, \*(lqseq_tup_read\*(rq,
-\*(lqidx_scan\*(rq, \*(lqidx_tup_fetch\*(rq, \*(lqn_tup_ins\*(rq,
-\*(lqn_tup_upd\*(rq, \*(lqn_tup_del\*(rq. The default is seq_scan.
+\*(lqsize\*(rq, \*(lqtime\*(rq. The default is cpu.
When viewing user index statistics: \*(lqidx_scan\*(rq,
\*(lqidx_tup_fetch\*(rq, \*(lqidx_tup_read\*(rq. The default is idx_scan.
.TP
@@ -290,9 +287,6 @@ id.)
Quit
.IR pg_top.
.TP
-.B R
-Display user table statistics.
-.TP
.B r
Change the priority (the \*(lqnice\*(rq) of a list of processes.
This acts similarly to the command
diff --git a/pg_top.c b/pg_top.c
index d01f51d..386c7db 100644
--- a/pg_top.c
+++ b/pg_top.c
@@ -321,10 +321,6 @@ do_display(struct pg_top_context *pgtctx)
pg_display_index_stats(pgtctx->values, pgtctx->index_order_index,
max_topn);
break;
- case MODE_TABLE_STATS:
- pg_display_table_stats(pgtctx->values, pgtctx->table_order_index,
- max_topn);
- break;
#ifdef __linux__
case MODE_IO_STATS:
for (i = 0; i < active_procs; i++)
@@ -766,7 +762,6 @@ main(int argc, char *argv[])
pgtctx.ps.command = NULL;
pgtctx.show_tags = No;
pgtctx.statement_order_index = 0;
- pgtctx.table_order_index = 0;
pgtctx.topn = 0;
/* Show help or version number if necessary */
diff --git a/pg_top.h b/pg_top.h
index 7e1171e..c336151 100644
--- a/pg_top.h
+++ b/pg_top.h
@@ -111,7 +111,6 @@ struct pg_top_context
struct statics statics;
struct system_info system_info;
struct timeval timeout;
- int table_order_index;
int topn;
const char *values[6];
};