-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdot_psqlrc
21 lines (18 loc) · 1.07 KB
/
dot_psqlrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
\set QUIET 1
\pset null '[null]'
\pset linestyle unicode
\pset border 2
\set HISTSIZE 2000
\x auto
\encoding unicode
\set QUIET 0
\set COMP_KEYWORD_CASE upper
\set index_hits 'select relname, 100*idx_scan/(seq_scan + idx_scan) percent_index_used, n_live_tup rows_in_table from pg_stat_user_tables where seq_scan + idx_scan > 0 order by n_live_tup desc;'
\set cache_hits 'select sum(heap_blks_read) as heap_read, sum(heap_blks_hit) as heap_hit, sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio from pg_statio_user_tables;'
\set slow_queries 'select (total_time / 1000 / 60) as total_minutes, (total_time/calls) as average_time_ms, query from pg_stat_statements order by average_time_ms DESC LIMIT 150;'
\set enable_stats 'create extension if not exists pg_stat_statements;'
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
-- PROMPT2 is printed when the prompt expects more input, like when you type
-- SELECT * FROM<enter>. %R shows what type of input it expects.
\set PROMPT2 '[more] %R > '