-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsqlrc
20 lines (14 loc) · 835 Bytes
/
psqlrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- no worky in my version :(
-- \pset expanded auto
\timing on
-- show user, host, date, and db in prompt
\set PROMPT1 '(%n@%M:%>) %`date +%H:%M:%S` [%/] \n%x%# '
\set PROMPT2 ''
-- Print null fields as NULL
\pset null 'NULL'
-- Set the command history file names for each database
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTSIZE 2000
-- aliased queries
\set waits 'SELECT pg_stat_activity.procpid, pg_stat_activity.current_query, pg_stat_activity.waiting, now() - pg_stat_activity.query_start as "totaltime", pg_stat_activity.backend_start FROM pg_stat_activity WHERE pg_stat_activity.current_query !~ \'%IDLE%\'::text AND pg_stat_activity.waiting = true;;'
\set locks 'select pid,mode,current_query from pg_locks,pg_stat_activity where granted=false and locktype=\'transactionid\' and pid=procpid order by pid,granted;;'