Skip to content

Commit

Permalink
fix: postgres set max parallel workers per gather to 4 (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Dec 1, 2021
1 parent a9480d9 commit 9cdfcfa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/db/postgres/config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SET max_parallel_workers_per_gather TO 4;
5 changes: 5 additions & 0 deletions packages/db/scripts/cmds/db-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ const { Client } = pg
*/
export async function dbSqlCmd ({ reset, cargo, testing } = {}) {
// read all the SQL files
const configSql = fs.readFileSync(path.join(__dirname, '../../postgres/config.sql'), {
encoding: 'utf-8'
})

const tablesSql = fs.readFileSync(path.join(__dirname, '../../postgres/tables.sql'), {
encoding: 'utf-8'
})
Expand Down Expand Up @@ -57,6 +61,7 @@ export async function dbSqlCmd ({ reset, cargo, testing } = {}) {
await client.query(resetSql)
}

await client.query(configSql)
await client.query(tablesSql)

if (cargo) {
Expand Down
2 changes: 2 additions & 0 deletions packages/infra/heroku/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ heroku addons:create heroku-postgresql:premium-4 --app=web3-storage-prod --name=

# Add schema
heroku pg:psql web3-storage-staging-0 --app=web3-storage-staging
# ...run schema SQL from /packages/db/config.sql
# ...run schema SQL from /packages/db/tables.sql
# ...run schema SQL from /packages/db/fdw.sql with credentials replaced
# ...run schema SQL from /packages/db/cargo.sql
# ...run schema SQL from /packages/db/functions.sql
heroku pg:psql web3-storage-prod-0 --app=web3-storage-prod
# ...run schema SQL from /packages/db/config.sql
# ...run schema SQL from /packages/db/tables.sql
# ...run schema SQL from /packages/db/fdw.sql with credentials replaced
# ...run schema SQL from /packages/db/cargo.sql
Expand Down

0 comments on commit 9cdfcfa

Please sign in to comment.