Skip to content

Instantly share code, notes, and snippets.

@rgarner
Created July 31, 2014 09:27
Show Gist options
  • Save rgarner/808637218c0502f5e63b to your computer and use it in GitHub Desktop.
Save rgarner/808637218c0502f5e63b to your computer and use it in GitHub Desktop.
Small .psqlrc
-- disable output temporarily
\set QUIET on
\timing
\x auto
\pset linestyle unicode
-- nicer rendering for null
\pset null 'NULL'
-- nicer prompt
\set PROMPT1 '\npsql %[%033[0;33;32m%]%/%[%033[0m%] on %[%033[0;33;33m%]%M%[%033[0m%] as %[%033[0;33;35m%]%n%[%033[0m%] %[%033[0;33;36m%]%x%[%033[0m%]\n%R> '
\set PROMPT2 '%R> '
-- better errors
\set VERBOSITY verbose
-- keep inputs in the history once
\set HISTCONTROL ignoredups
--
-- Aliases
--
--- Running queries, use :q to check. If you want to paste the query for an
--- EXPLAIN, worth setting unaligned `\a` output first
\set q 'SELECT pid, query, now() - query_start AS running_for FROM pg_stat_activity WHERE query NOT LIKE ''SELECT pid%'';';
-- output back on
\set QUIET off
set work_mem="16MB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment