David Hancock

Aug 25

pg_controldata

I found a nice PostgreSQL command the other day: pg_controldata. Takes one argument (the path to the data directory) and returns a whole bunch of useful information about the instance. This’ll be useful for determining how up to date a PostgreSQL warm standby database is. See the line below labeled “Time of latest checkpoint.” There’s other useful information in the output:

[root@localhost data]# pg_controldata /usr/local/pgsql/data
pg_control version number:            833
Catalog version number:               200711281
Database system identifier:           5187205705949378879
Database cluster state:               in archive recovery
pg_control last modified:             Mon 25 Aug 2008 02:12:08 PM EDT
Latest checkpoint location:           0/1A7CCD44
Prior checkpoint location:            0/167A4728
Latest checkpoint's REDO location:    0/190006A0
Latest checkpoint's TimeLineID:       1
Latest checkpoint's NextXID:          0/679574
Latest checkpoint's NextOID:          24581
Latest checkpoint's NextMultiXactId:  1
Latest checkpoint's NextMultiOffset:  0
Time of latest checkpoint:            Mon 25 Aug 2008 02:01:38 PM EDT
Minimum recovery ending location:     0/C81D500
Maximum data alignment:               4
Database block size:                  8192
Blocks per segment of large relation: 131072
WAL block size:                       8192
Bytes per WAL segment:                16777216
Maximum length of identifiers:        64
Maximum columns in an index:          32
Maximum size of a TOAST chunk:        2000
Date/time type storage:               floating-point numbers
Maximum length of locale name:        128
LC_COLLATE:                           en_US.UTF-8
LC_CTYPE:                             en_US.UTF-8

Thanks to http://www.kennygorman.com/wordpress/?p=249 for the idea.