deeejay icon

psql - Misc admin queries

deeejay | PRO | 01/05/16 06:35:05 PM UTC | 0 ⭐ | 291 👁️ | Never ⏰ | []
text |

1.5 KB

|

None

|

0 👍

/

0 👎

Server Configuration (for troubleshooting support)
===
SELECT version();
SELECT name, current_setting(name), SOURCE
  FROM pg_settings
  WHERE SOURCE NOT IN ('default', 'override');
 View encoding
===
SHOW SERVER_ENCODING;
SHOW CLIENT_ENCODING;
SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'db_name';
 View data file path
===
SHOW DATA_DIRECTORY;
 View postgresql.conf
===
SELECT * FROM pg_settings;
 Check if PG is in recovery mode
===
SELECT pg_is_in_recovery();
 View replication status
===
SELECT * FROM pg_stat_replication;
 pid:              Process id of walsender process
usesysid:         OID of user which is used for Streaming replication.
usename:          Name of user which is used for Streaming replication
application_name: Application name connected to master
client_addr:      Address of standby/streaming replication
client_hostname:  Hostname of standby.
client_port:      TCP port number on which standby communicating with WAL sender
backend_start:    Start time when SR connected to Master.
state:            Current WAL sender state i.e streaming
sent_location:    Last transaction location sent to standby.
write_location:   Last transaction written on disk at standby
flush_location:   Last transaction flush on disk at standby.
replay_location:  Last transaction flush on disk at standby.
sync_priority:    Priority of standby server being chosen as synchronous standby
sync_state:       Sync State of standby (is it async or synchronous).

Comments