forked from NikolayS/postgres_dba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.psql
46 lines (45 loc) · 1.25 KB
/
start.psql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
\echo Menu:
\echo ' 1 – Basic Node Information (master/replica, lag, DB size, tmp files)'
\echo ' 2 – ....'
\echo ' 3 - Slowest Queries'
\echo ' i1 - Unused/Redundant Indexes'
\echo ' i2 - Rarely Used Indexes'
\echo ' q – Quit from this tool'
\echo
\echo 'Type your choice and press <Enter>:'
\prompt d_step_unq
\set d_stp '\'' :d_step_unq '\''
select
:d_stp::text = '1' as d_step_is_1,
:d_stp::text = '2' as d_step_is_2,
:d_stp::text = '3' as d_step_is_3,
:d_stp::text = 'i1' as d_step_is_i1,
:d_stp::text = 'i2' as d_step_is_i2,
:d_stp::text = 'q' as d_step_is_q \gset
\if :d_step_is_1
\i ./general/basic.sql
\prompt 'Press <Enter> to continue…' d_dummy
\i ./start.psql
\elif :d_step_is_2
\echo ' 2 is chosen!'
\prompt 'Press <Enter> to continue…' d_dummy
\i ./start.psql
\elif :d_step_is_3
\echo ' 3 is chosen!'
\prompt 'Press <Enter> to continue…' d_dummy
\i ./start.psql
\elif :d_step_is_i1
\i ./indexes/redundant.sql
\prompt 'Press <Enter> to continue…' d_dummy
\i ./start.psql
\elif :d_step_is_i2
\i ./indexes/rare.sql
\prompt 'Press <Enter> to continue…' d_dummy
\i ./start.psql
\elif :d_step_is_q
\echo 'Bye!'
\echo
\else
\echo 'ERROR: Unkown option!'
\i ./start.psql
\endif