Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Created April 18, 2015 11:18
Show Gist options
  • Save crmaxx/c5cfa29d981c4360b291 to your computer and use it in GitHub Desktop.
Save crmaxx/c5cfa29d981c4360b291 to your computer and use it in GitHub Desktop.
~/.psqlrc
\set QUIET 1
\timing
\set ON_ERROR_ROLLBACK interactive
\set VERBOSITY verbose
\x auto
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
\set PROMPT2 ''
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\pset null [null]
\set uptime 'select now() - backend_start as uptime from pg_stat_activity where pid = pg_backend_pid();'
\set slaves 'select application_name, pg_xlog_location_diff(sent_location, flush_location) as replay_delta, sync_priority, sync_state from pg_stat_replication;'
\set show_slow_queries 'SELECT (total_time / 1000 / 60) as total_minutes, (total_time/calls) as average_time, query FROM pg_stat_statements ORDER BY 1 DESC LIMIT 100;'
\pset linestyle unicode
\pset border 2
\unset QUIET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment