-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
75 lines (55 loc) · 1.93 KB
/
Makefile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
sh:
devbox shell
install:
devbox run "cd src && go mod tidy"
up:
devbox run --env-file .env "cd src && go run ."
.PHONY: build
build:
rm -rf build/bemidb-* && \
devbox run "./scripts/build-darwin.sh" && \
./scripts/build-linux.sh
sync:
devbox run --env-file .env "cd src && go run . sync"
test:
devbox run "cd src && go test ./..."
debug:
devbox run "cd src && dlv test github.com/BemiHQ/BemiDB"
lint:
devbox run "cd src && go fmt"
outdated:
devbox run "cd src && go list -u -m -f '{{if and .Update (not .Indirect)}}{{.}}{{end}}' all"
.PHONY: benchmark
benchmark:
devbox run "time psql postgres://127.0.0.1:54321/bemidb < ./benchmark/queries.sql"
pg-init:
devbox run initdb &&
sed -i "s/#log_statement = 'none'/log_statement = 'all'/g" ./.devbox/virtenv/postgresql/data/postgresql.conf && \
sed -i "s/#logging_collector = off/logging_collector = on/g" ./.devbox/virtenv/postgresql/data/postgresql.conf && \
sed -i "s/#log_directory = 'log'/log_directory = 'log'/g" ./.devbox/virtenv/postgresql/data/postgresql.conf
pg-up:
devbox services start postgresql
pg-create:
devbox run "(dropdb tpch || true) && \
createdb tpch && \
./benchmark/scripts/load-pg-data.sh"
pg-index:
devbox run "psql postgres://127.0.0.1:5432/tpch -f ./benchmark/data/create-indexes.ddl"
pg-benchmark:
devbox run "psql postgres://127.0.0.1:5432/tpch -c 'ANALYZE VERBOSE' && \
time psql postgres://127.0.0.1:5432/tpch < ./benchmark/queries.sql"
pg-down:
devbox services stop postgresql
pg-logs:
tail -f .devbox/virtenv/postgresql/data/log/postgresql-*.log
pg-sniff:
sudo tshark -i lo0 -f 'tcp port 5432' -d tcp.port==5432,pgsql -O pgsql
tpch-install:
devbox run "cd benchmark && \
git clone https://github.com/gregrahn/tpch-kit.git
cd tpch-kit/dbgen
make MACHINE=$$MACHINE DATABASE=POSTGRESQL"
tpch-generate:
devbox run "./benchmark/scripts/generate-data.sh"
sniff:
sudo tshark -i lo0 -f 'tcp port 54321' -d tcp.port==54321,pgsql -O pgsql