deeejay

psql - Misc admin queries

Jan 5th, 2016
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. Server Configuration (for troubleshooting support)
  2. ===
  3. SELECT version();
  4. SELECT name, current_setting(name), SOURCE
  5. FROM pg_settings
  6. WHERE SOURCE NOT IN ('default', 'override');
  7.  
  8. View encoding
  9. ===
  10. SHOW SERVER_ENCODING;
  11. SHOW CLIENT_ENCODING;
  12. SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'db_name';
  13.  
  14. View data file path
  15. ===
  16. SHOW DATA_DIRECTORY;
  17.  
  18. View postgresql.conf
  19. ===
  20. SELECT * FROM pg_settings;
  21.  
  22. Check if PG is in recovery mode
  23. ===
  24. SELECT pg_is_in_recovery();
  25.  
  26. View replication status
  27. ===
  28. SELECT * FROM pg_stat_replication;
  29.  
  30. pid: Process id of walsender process
  31. usesysid: OID of user which is used for Streaming replication.
  32. usename: Name of user which is used for Streaming replication
  33. application_name: Application name connected to master
  34. client_addr: Address of standby/streaming replication
  35. client_hostname: Hostname of standby.
  36. client_port: TCP port number on which standby communicating with WAL sender
  37. backend_start: Start time when SR connected to Master.
  38. state: Current WAL sender state i.e streaming
  39. sent_location: Last transaction location sent to standby.
  40. write_location: Last transaction written on disk at standby
  41. flush_location: Last transaction flush on disk at standby.
  42. replay_location: Last transaction flush on disk at standby.
  43. sync_priority: Priority of standby server being chosen as synchronous standby
  44. sync_state: Sync State of standby (is it async or synchronous).
Advertisement
Add Comment
Please, Sign In to add comment