Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor

Showing 2 changed files with 6 additions and 12 deletions. Show diff stats Hide diff stats

  1. +1 8 Makefile
  2. +5 4 pgstats.c
9 Makefile
... ... @@ -1,6 +1,6 @@
1 1 # contrib/pgstats/Makefile
2 2
3   -PGFILEDESC = "pgstats - examine the file structure"
  3 +PGFILEDESC = "pgstats - grabs all statistics, and stores them in .csv files"
4 4 PGAPPICON = win32
5 5
6 6 PROGRAM = pgstats
@@ -9,13 +9,6 @@ OBJS = pgstats.o
9 9 PG_CPPFLAGS = -I$(libpq_srcdir)
10 10 PG_LIBS = $(libpq_pgport)
11 11
12   -ifdef USE_PGXS
13 12 PG_CONFIG = pg_config
14 13 PGXS := $(shell $(PG_CONFIG) --pgxs)
15 14 include $(PGXS)
16   -else
17   -subdir = contrib/pgstats
18   -top_builddir = ../..
19   -include $(top_builddir)/src/Makefile.global
20   -include $(top_srcdir)/contrib/contrib-global.mk
21   -endif
9 pgstats.c
@@ -2,7 +2,7 @@
2 2 * pgstats, a PostgreSQL app to gather statistical informations
3 3 * from a PostgreSQL database.
4 4 *
5   - * Guillaume Lelarge, guillaume@lelarge.info, 2011.
  5 + * Guillaume Lelarge, guillaume@lelarge.info, 2011-2012.
6 6 *
7 7 * contrib/pgstats/pgstats.c
8 8 */
@@ -338,7 +338,7 @@ sql_exec_dump_pgstatactivity()
338 338 "SELECT date_trunc('seconds', now()), datid, datname, %s, "
339 339 "usesysid, usename, %s%s%s%s%s"
340 340 "date_trunc('seconds', query_start) AS query_start, "
341   - "%s%s "
  341 + "%s%s%s "
342 342 "FROM pg_stat_activity "
343 343 "ORDER BY %s",
344 344 backend_minimum_version(9, 2) ? "pid" : "procpid",
@@ -347,6 +347,7 @@ sql_exec_dump_pgstatactivity()
347 347 backend_minimum_version(9, 1) ? "client_hostname, " : "",
348 348 backend_minimum_version(8, 1) ? "client_port, date_trunc('seconds', backend_start) AS backend_start, " : "",
349 349 backend_minimum_version(8, 3) ? "date_trunc('seconds', xact_start) AS xact_start, " : "",
  350 + backend_minimum_version(9, 2) ? "state_change, " : "",
350 351 backend_minimum_version(8, 2) ? "waiting, " : "",
351 352 backend_minimum_version(9, 2) ? "query" : "current_query",
352 353 backend_minimum_version(9, 2) ? "pid" : "procpid");
@@ -398,7 +399,7 @@ sql_exec_dump_pgstatdatabase()
398 399 "ORDER BY datname",
399 400 backend_minimum_version(8, 3) ? ", tup_returned, tup_fetched, tup_inserted, tup_updated, tup_deleted" : "",
400 401 backend_minimum_version(9, 1) ? ", conflicts, date_trunc('seconds', stats_reset) AS stats_reset" : "",
401   - backend_minimum_version(9, 2) ? ", temp_files, temp_bytes, deadlocks, block_read_time, block_write_time" : "");
  402 + backend_minimum_version(9, 2) ? ", temp_files, temp_bytes, deadlocks, blk_read_time, blk_write_time" : "");
402 403 snprintf(filename, sizeof(filename),
403 404 "%s/pg_stat_database.csv", opts->directory);
404 405
@@ -438,7 +439,7 @@ sql_exec_dump_pgstatreplication()
438 439 snprintf(todo, sizeof(todo),
439 440 "SELECT date_trunc('seconds', now()), %s, usesysid, usename, "
440 441 "application_name, client_addr, client_hostname, client_port, "
441   - "date_trunc('seconds', backend_start), state, "
  442 + "date_trunc('seconds', backend_start) AS backend_start, state, "
442 443 "pg_current_xlog_location() AS master_location, "
443 444 "sent_location, write_location, flush_location, replay_location, "
444 445 "sync_priority, "

No commit comments for this range

Something went wrong with that request. Please try again.