File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Reset template database
2+ ```
3+ UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';
4+ \c template0
5+ UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
6+ DROP DATABASE template1;
7+ CREATE DATABASE template1 WITH TEMPLATE = 'template0';
8+ \c template1
9+ UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
10+ UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template0';
11+ ```
12+
13+
14+ # the common technique for speeding postgres test
15+ - disable fsync
16+ - use transaction and rollback
17+ - template database (it is faster to drop and recreate database)
18+
19+ They are all outlined here https://www.maragu.dk/blog/speeding-up-postgres-integration-tests-in-go/
You can’t perform that action at this time.
0 commit comments