-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathcli.sh
More file actions
executable file
·49 lines (43 loc) · 809 Bytes
/
cli.sh
File metadata and controls
executable file
·49 lines (43 loc) · 809 Bytes
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
46
47
48
49
#!/bin/bash
#
# Dev CLI.
#
set -ex
# Connect to the admin database.
function admin() {
PGPASSWORD=pgdog psql -h 127.0.0.1 -p 6432 -U admin admin
}
# Run pgbench.
#
# Arguments:
#
# - protocol: simple|extended|prepared
#
function bench() {
PGPASSWORD=pgdog pgbench -h 127.0.0.1 -p 6432 -U pgdog pgdog --protocol ${1:-simple} -t 100000000 -c 10 -P 1 -S
}
function bench_init() {
PGPASSWORD=pgdog pgbench -h 127.0.0.1 -p 6432 -U pgdog pgdog -i
}
function psql_cmd() {
PGPASSWORD=pgdog psql -h 127.0.0.1 -p 6432 -U pgdog $1
}
# Parse command
case "$1" in
admin)
admin
;;
psql)
psql_cmd $2
;;
binit)
bench_init
;;
bench)
bench $2
;;
*)
echo "Usage: $0 {admin} {bench}"
exit 1
;;
esac