-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: db optimizations, backups optimizations (#1664)
- Loading branch information
Showing
8 changed files
with
49 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
SET max_parallel_workers_per_gather TO 4; | ||
-- PG doesn't support ALTER DATABASE CURRENT, and the db name is different between local/staging/production | ||
-- So we have to execute using variable subsitution | ||
DO $$ | ||
BEGIN | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET default_statistics_target = 1000'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET enable_partitionwise_aggregate = on'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET enable_partitionwise_join = on'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET max_parallel_workers_per_gather = 8'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET max_parallel_workers = 16'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET max_parallel_maintenance_workers = 8'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET jit = on'; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET idle_in_transaction_session_timeout = ''1min'''; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET lock_timeout = ''1min'''; | ||
EXECUTE 'ALTER DATABASE ' || current_database() || ' SET statement_timeout = ''30s'''; | ||
END | ||
$$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters